import { Request, Response, NextFunction } from "express"; export const catchAsync = (fn: Function) => async (req: Request, res: Response, next: NextFunction) => { try { await fn(req, res, next); } catch (error) { next(error); } };