import { ZodSchema } from "zod"; import { Request, Response, NextFunction } from "express"; export const validate = (schema: ZodSchema) => (req: Request, _res: Response, next: NextFunction) => { try { schema.parse({ body: req.body, params: req.params, query: req.query, }); next(); } catch (err) { next(err); } };