Last active
March 25, 2017 01:01
-
-
Save rxon/8f4c64b3af119ffe7151b5fbeeacd215 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isCorrectSchema(req, res, next) { | |
const ajv = new require('ajv')(); | |
const valid = ajv.validate(schema, req.body); | |
if (!valid) { | |
res.status(400).send('Bad Request: ${ajv.errors}'); | |
} | |
return next(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment