You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

14 lines
413 B

import {validationResult} from "express-validator";
export default async function validator(req, res, next) {
const errors = validationResult(req);
if (!errors.isEmpty()) {
const logger = req.body.logger;
logger.write("failed due to invalid values", 400);
console.log(req.body);
return res.status(400).json({ errors: errors.array() });
} else {
next()
}
}