@zarfjs/adapter-bun
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

@zarfjs/adapter-bun

Bun adapter for Zarf. Provide a Zarf app, and let this adapter adapt the incoming requests and outgoing responses into a format Bun understands. This is like Zarf's listen method, but outside and consistent with the rest of the adapter ecosystem. Eventually, with Zarf going slim, and runtime agnostice, you'll have only this!

Note: Experimental, as Bun's cutting edge and you'll need either containers/Docker or something like fly.io to work with Bun.sh today

Usage


import { Zarf } from '@zarfjs/zarf'
import { createServer } from '@zarfjs/adapter-bun'

const app = new Zarf()

app.get("/hello/:user", (ctx, params) => {
    return ctx.json({
        hello: params.user
    })
})

createServer(app).listen({
    port: 3000
}, (server) => {
    console.log(`Server started on ${server.port}`)
})

Author


Aftab Alam https://github.com/one-aalam

License


Distributed under the MIT License. See LICENSE for more information.

Package Sidebar

Install

npm i @zarfjs/adapter-bun

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

8.29 kB

Total Files

6

Last publish

Collaborators

  • one-aalam