📅  最后修改于: 2022-03-11 15:01:25.197000             🧑  作者: Mango
function validateRegForm(req, res, next){
console.log('Validating form...');
if(!req.body.password){
return res.send(500, 'Need a password');
};
next();
};
app.post('/regForm'
, validateRegForm
, function(req,res){
// If Express calls this fn, the previous fn did next(), not res.send()
console.log('Doing something with this valid form');
res.redirect('/regForm/complete');
});