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

0.0.8 • Public • Published

@zarfjs/adapter-node

Node.js adapter for Zarf. Provide a Zarf app, and let this adapter adapt the incoming requests and outgoing responses into a format Node.js understands.

Note: It works, but it's yet to be fully tested for compatibility issues

Usage


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

const app = new Zarf()

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

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

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-node

Weekly Downloads

1

Version

0.0.8

License

MIT

Unpacked Size

11.4 kB

Total Files

6

Last publish

Collaborators

  • one-aalam