implement an entire base refacotr and alot of styling overhauls and remakes.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
export function validateBody(validator) {
|
||||
return (req, res, next) => {
|
||||
const result = validator(req.body || {}, req);
|
||||
if (result?.error) {
|
||||
return res.status(400).json({error: result.error});
|
||||
}
|
||||
req.validatedBody = result?.value ?? req.body ?? {};
|
||||
return next();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user