Skip to main content

Node

Module Overview

The RequestRouter can be made compatible with Node.js via the createServerHandler wrapper function:

import * as http from 'node:http'
import { RequestRouter } from 'keywork/router'
import { createServerHandler } from 'keywork/router/node'

// Create a router as you usually do...
const router = new RequestRouter()
router.get('/', () => 'Hello from Node')

// And then wrap the router with `createServerHandler`
http.createServer(createServerHandler(router))
caution

Node support is currently experimental and may change in the near future.

Usage

import * as Node from 'keywork/router/node'

Type Aliases

Functions