method HTTPServer.serve
HTTPServer.serve(
config?: { port: number; onListen?: (s: object) => void; onError?: (e: Error) => void; },
handler: (
req: http.IncomingMessage,
res: http.ServerResponse
) => void
): Promise<http.Server>

Creates and starts a plain http.createServer instance on the given port.

Parameters

optional
config: { port: number; onListen?: (s: object) => void; onError?: (e: Error) => void; }
handler: (
req: http.IncomingMessage,
res: http.ServerResponse
) => void

Return Type

Promise<http.Server>

Usage

import HTTPServer from "lib/servers/http.ts";