nœud js valider le corps sans middleware

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');
});
Better Bug