Spaces:
Paused
Paused
Download server/src/middleware/validate.ts from testfirela/paperclip-app: direct link, hf CLI and curl.
- Browser
- Download file 272 Bytes
-
https://huggingface.co/spaces/testfirela/paperclip-app/resolve/main/server/src/middleware/validate.ts
- Command line
-
hf download hf://spaces/testfirela/paperclip-app/server/src/middleware/validate.ts
-
curl -L -o validate.ts https://huggingface.co/spaces/testfirela/paperclip-app/resolve/main/server/src/middleware/validate.ts
272 Bytes
| 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(); | |
| }; | |
| } | |