UNPKG

@kronos-integration/service-http

Version:
40 lines (39 loc) 1.14 kB
/** * * @param {HTTPServer} httpService * @return {RequestListener} */ export function endpointRouter(httpService: HTTPServer): RequestListener; /** * @typedef {Object} CTX * @property {ServerResponse} res * @property {ServerRequest} req * @property {Function} is * @property {Function} throw */ /** * Endpoint to link against a http route. * * The endpoint name may be in the form of '<METHOD>:<path>'. * Then <METHOD> will be used as http method * and <path> as the url path component. * @param {string} name endpoint name * @param {Object} owner owner of the endpoint * @param {Object} options * @param {string} options.path url path component defaults to endpoint name * @param {string} options.method http method defaults to GET */ export class HTTPEndpoint extends SendEndpoint { constructor(name: any, owner: any, options: any); get method(): any; get path(): any; #private; } export type CTX = { res: ServerResponse; req: ServerRequest; is: Function; throw: Function; }; import { Server as HTTPServer } from "node:http"; import { SendEndpoint } from "@kronos-integration/endpoint";