I can't use a function with express-validator
Here is my code (without function)
module.exports.user = [
validator.body('username', 'test').isLength({ min: 1 }),
function(req, res) {
const errors = validator.validationResult(req);
if (!errors.isEmpty()) {
return res.status(422).json({ errors: errors.mapped() });
}
}
]
When I do module.exports.user_get = function(req, res) { I get an error
I'm trying to use requests.cookies with a custom validator, but if I don't import the function I couldn't use it