UNPKG

ts-express-kit

Version:

A TypeScript starter kit for building Express applications with best practices.

9 lines (7 loc) 295 B
import { NextFunction, Request, RequestHandler, Response } from "express"; const catchAsync = (fn: RequestHandler) => { return (req: Request, res: Response, next: NextFunction) => { Promise.resolve(fn(req, res, next)).catch((err) => next(err)); }; }; export default catchAsync;