10 lines
259 B
JavaScript
10 lines
259 B
JavaScript
const { validationResult } = require('express-validator');
|
|
|
|
module.exports = (req, res, next) => {
|
|
const errors = validationResult(req);
|
|
if (!errors.isEmpty()) {
|
|
return res.status(400).json({ errors: errors.array() });
|
|
}
|
|
next();
|
|
}
|
|
//IO
|