mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 10:50:38 +09:00
10 lines
272 B
TypeScript
10 lines
272 B
TypeScript
|
|
import type { Request, Response, NextFunction } from "express";
|
||
|
|
import type { ZodSchema } from "zod";
|
||
|
|
|
||
|
|
export function validate(schema: ZodSchema) {
|
||
|
|
return (req: Request, _res: Response, next: NextFunction) => {
|
||
|
|
req.body = schema.parse(req.body);
|
||
|
|
next();
|
||
|
|
};
|
||
|
|
}
|