Last active
December 26, 2015 19:52
-
-
Save subkitio/9427adee121567892f3f to your computer and use it in GitHub Desktop.
HTTP Input Validation
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
const jsonSchema = require('json-schema'); | |
var schema = { | |
"description" : "A geographical coordinate", | |
"type" : "object", | |
"properties" : { | |
"latitude" : { "type" : "number", "required":true }, | |
"longitude" : { "type" : "number", "required":true } | |
} | |
}; | |
var result = jsonSchema.validate({latitude: 0, longitude: 'string'}, schema); | |
res.send(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment