express validate.js validate.js验证框架的中间件包装器
Express validate.js验证框架的中间件包装器
安装
$ npm install express-validate.js
例子
var validate = require('express-validate.js');
var express = require('express');
express()
.get('/user/:userId/:page?', validate({
userId: {
scope: 'route',
presence: true,
format: {
pattern: /\\d{5}/,
message: 'must be a five digit number'
}
}
}));
用户评论