UNPKG

@riddance/host

Version:

28 lines (27 loc) 1.18 kB
import { HandlerConfiguration } from '../context.js'; import { Handler } from '../http.js'; export type HttpHandler = { meta: Metadata | undefined; config: FullConfiguration | undefined; method: Method; pathPattern: string; entry: Handler; }; type HandlerTypes = { http: HttpHandler; }; export declare function getHandlers(type: keyof HandlerTypes): HttpHandler[]; export declare function getHandler(type: keyof HandlerTypes): HttpHandler; export declare function setMeta(packageName: string, fileName: string, revision: string | undefined, config: PackageConfiguration | undefined): void; export type PackageConfiguration = HandlerConfiguration & {}; export type FullConfiguration = PackageConfiguration & HandlerConfiguration; export type Metadata = { packageName: string; fileName: string; revision: string | undefined; config?: PackageConfiguration; }; export declare function pathToRegExp(path: string): RegExp; export type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; export declare function registerHttpHandler(method: Method, path: string, configOrHandler: HandlerConfiguration | Handler, fn?: Handler): void; export {};