UNPKG

node-enterprise-starter

Version:

<h1 align="center">Node Enterprise Starter</h1>

11 lines (8 loc) 382 B
import { NextFunction, Request, RequestHandler, Response } from 'express'; // If you want to see its use check the validateRequest.ts file inside the middleware folder. const catchAsync = (fn: RequestHandler) => { return (req: Request, res: Response, next: NextFunction) => { Promise.resolve(fn(req, res, next)).catch((err) => next(err)); }; }; export default catchAsync;