Files

17 lines
319 B
JavaScript
Raw Permalink Normal View History

const { body, validationResult } = require('express-validator');
const validate = (req, res, next) => {
const errors = validationResult(req);
if (!errors.isEmpty()) {
return res.status(400).json({
success: false,
errors: errors.array()
});
}
next();
};
module.exports = {
validate
};