@chubbyts/chubbyts-framework
Version:
A minimal, highly performant middleware PSR-15 inspired function based microframework built with as little complexity as possible, aimed primarily at those developers who want to understand all the vendors they use.
17 lines (16 loc) • 929 B
TypeScript
import type { ResponseFactory } from '@chubbyts/chubbyts-http-types/dist/message-factory';
import type { Middleware } from '@chubbyts/chubbyts-http-types/dist/middleware';
import type { Logger } from '@chubbyts/chubbyts-log-types/dist/log';
import type { MapToHttpError } from '@chubbyts/chubbyts-http-error/dist/http-error';
/**
* ```ts
* import type { Middleware } from '@chubbyts/chubbyts-http-types/dist/middleware';
* import type { ResponseFactory } from '@chubbyts/chubbyts-http-types/dist/message-factory';
* import { createErrorMiddleware } from '@chubbyts/chubbyts-framework/dist/middleware/error-middleware';
*
* const responseFactory: ResponseFactory = ...;
*
* const errorMiddleware: Middleware = createErrorMiddleware(responseFactory);
* ```
*/
export declare const createErrorMiddleware: (responseFactory: ResponseFactory, debug?: boolean, logger?: Logger, mapToHttpError?: MapToHttpError) => Middleware;