Absorbs the separate control-panel git repo as a subdirectory. Instances and backups directories excluded via .gitignore. Bunker Admin
17 lines
416 B
TypeScript
17 lines
416 B
TypeScript
import { Request, Response, NextFunction } from 'express';
|
|
import { ZodSchema } from 'zod';
|
|
|
|
export function validate(schema: ZodSchema) {
|
|
return (req: Request, _res: Response, next: NextFunction) => {
|
|
schema.parse(req.body);
|
|
next();
|
|
};
|
|
}
|
|
|
|
export function validateQuery(schema: ZodSchema) {
|
|
return (req: Request, _res: Response, next: NextFunction) => {
|
|
schema.parse(req.query);
|
|
next();
|
|
};
|
|
}
|