A middleware for handling errors in Express applications.

// Usage example
import { ExpressMiddlewares } from 'your-package-name';

app.use(ExpressMiddlewares.errorHandler);

errHandler - The original errorHandler middleware function with its own documentation.

  • Parameters

    • err: any
    • req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>
    • res: Response<any, Record<string, any>, number>
    • next: NextFunction

    Returns void | Promise<void>