body-schema
v0.0.1
Published
JSON schema based validation middleware for express/connect
Downloads
13
Maintainers
Readme
JSON schema based validation for express routes. Validate req.body declaratively using JSON schemas. Uses tv4 to create body validation middelware.
Install
$ npm install --save body-schema
Usage
var bodySchema = require('body-schema');
var loginSchema = {
'type': 'object',
'properties': {
'username': {
'type': 'string'
},
'password': {
'type': 'string'
}
},
'required': ['username', 'password']
};
app.post('/login', bodySchema(loginSchema), login);
License
MIT © Andrew Lavers