Created
January 30, 2017 18:06
-
-
Save samueljoli/f8d9f15536d5e6ddd5eab944b13fbb39 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const documentSchema = Joi.object().keys({/*property definitions here*/}); | |
| Joi.validate(document, documentSchema, function(err, value) { | |
| if (err) { | |
| throw new Error(‘Document failed validation’); | |
| } else { | |
| // write doc to PG | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment