Skip to main content

createServerHandler

Overview

createServerHandler

createServerHandler<BoundAliases>(router): [`ServerHandler`](../types/ServerHandler.mdx)

Given a RequestRouter, creates a Node-compatible server handler.

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

const router = new RequestRouter()
http.createServer(createServerHandler(router))

See

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

Type parameters

NameType
BoundAliases{}

Parameters

NameType
routerRequestRouter<BoundAliases>

Returns

ServerHandler

Defined in

router/node/functions/createServerHandler.ts:39