Skip to content

Instantly share code, notes, and snippets.

@brunoluiz
Last active August 26, 2017 16:12
Show Gist options
  • Save brunoluiz/12de73f57bb10f3eaf19e57521881267 to your computer and use it in GitHub Desktop.
Save brunoluiz/12de73f57bb10f3eaf19e57521881267 to your computer and use it in GitHub Desktop.
module.exports = (req, res, next) => {
const ratings = Ratings.schema.validate(req.body)
if (ratings.error) {
return next(ratings.error)
}
req.parsed = ratings.value
return next()
}
// ....
app.post('/ratings',
ratingsValidator,
ratingsCreateController
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment