Skip to main content

respondWithRouter

Overview

respondWithRouter

respondWithRouter<BoundAliases>(router, nodeRequest, nodeResponse): `Promise<void>`

Given a RequestRouter, responds to an incoming request from a Node server.

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

const router = new RequestRouter()
http.createServer((req, res) => {
respondWithRouter(router, req, res)
})

See

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

Type parameters

NameType
BoundAliases{}

Parameters

NameType
routerRequestRouter<BoundAliases>
nodeRequestIncomingMessage
nodeResponseServerResponse

Returns

Promise<void>

Defined in

router/node/functions/respondWithRouter.ts:46