0.0.8 • Published 2 years ago

@zarfjs/adapter-node v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@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.