此代码工作正常。它抛出错误并显示在网页上。但现在我想挑选个别错误并显示到网页上。
// request.body validation
req.checkBody('email', 'Email is required.').notEmpty();
req.checkBody('name', 'Name is required.').notEmpty();
req.checkBody('phone', 'Phone is required.').isMobilePhone('en-IN');
req.checkBody('password1', 'Password is required.').isLength({min:6});
req.checkBody('password2', 'Password not same, try again!!').equals(password1);
var errors = req.validationErrors();
if (errors) {
console.log(req.body.params.errors);
res.render('form', {
errors: errors,
isForm: true,
register: true
});
} else {
console.log('PASSED');
}
console.log 错误的各个参数的代码是什么?