0.0.1 • Published 10 years ago
express-check v0.0.1
check
Expressjs data validation middleware.
API
var bodyParser = require('body-parser')
, check = require('express-check')
, rule = check.rule
;
var app = express();
// always use bodyParser before check middleware
app.use(bodyParser());
app.get(
'/login',
check('body',
rule('username').notEmpty(),
rule('password').isLength(6, 18)
)
);
check(dataSource, rule, rule)
dataSource
could be either body
, query
or params
.
Following a list of rule
created by check.rule()
check.rule(field)
field
is the field name that being validate.
License
MIT
0.0.1
10 years ago