/// import { NextMiddleware, Middleware } from "./core"; import { Context } from "./context"; import { Router } from "./router"; import * as net from "net"; import * as http from "http"; /** * The default error handler. It's executed at the end of * the middleware chain or whenever, an exception that's * not caught by the application is encountered. * * @export * @param {Error} err */ export declare function defaultErrorHandler(err: Error, req: http.IncomingMessage, res: http.ServerResponse): void; /** * A default fall-back handler that simply ends the request, and returns. * * @export * @param {IContext} context * @param {MiddlewareWithContext} next * @returns {Promise} Resolved Promise */ export declare function defaultFallbackOkHandler(context: Context, next: NextMiddleware): Promise; /** * The default fall-back handler that ends the request with 404 status code. * * @export * @param {IContext} context * @param {MiddlewareWithContext} next * @returns {Promise} Resolved Promise */ export declare function defaultFallbackNotFoundHandler(context: Context, next: NextMiddleware): Promise; export declare function defaultClientSocketErrorHandler(err: any, socket: net.Socket): void; /** * Composes multiple middlewares into one middleware that executes the middleware chain. * * @export * @template T {IContext} * @param {...Middleware[]} middlewares * @returns {Middleware} */ export declare function compose(...middlewares: Middleware[]): Middleware; export declare function dispatch(context: Context, next: NextMiddleware, middlewares: Middleware[]): Promise; /** * Stringify JSON, like JSON.stringify, but v8 optimized. */ export declare function stringify(value: any, replacer: (key: string, value: any) => any, spaces: string | number): string; export declare function addMiddlewares(middlewares: (Middleware | Router)[], destination: Middleware[]): void;