UNPKG

uspring

Version:

A very fast Webserver which has interface like springboot

29 lines 1.28 kB
import { TemplatedApp, HttpRequest, HttpResponse, RecognizedString, us_listen_socket } from "uWebSockets.js"; import { MicroResponse } from "./MicroResponse"; import { MicroRequest } from "./MicroRequest"; import { RequestMap } from "./RequestMapper"; declare type Callback = (res: HttpResponse, req: HttpRequest) => void; export declare type ShadowMiddleware = (req: MicroRequest, res: MicroResponse) => Promise<MicroRequest>; export declare type ExpressMiddleware = (req: HttpRequest, res: HttpResponse, next: Callback) => void; export interface Wrap { useExpress: (path: string, middleware: ExpressMiddleware) => Wrap; use: (fnOrStr: string | ShadowMiddleware, router?: RequestMap) => Wrap; listen(host: number | RecognizedString, cb: (listenSocket: us_listen_socket | any) => void): void; static(path: string, options: IStaticOption): Wrap; timeout: number; onTimeout: (req: any, res: any) => void; } interface IStaticOption { maxCache?: number; } export interface IStaticOptions { maxCache: number; } export interface IStaticFile { staticFilePaths: string[]; staticOptions: IStaticOption | undefined; dirs: string[]; } export declare function uApp(app: TemplatedApp): Wrap; export default uApp; //# sourceMappingURL=appwrapper.d.ts.map