I am trying to create a middleware that can accept parameters. How can this be done?
example
app.get('/hasToBeAdmin', HasRole('Admin'), function(req,res){
})
HasRole = function(role, req, res, next){
if(role != user.role){
res.redirect('/NotInRole);
}
next();
}
See Question&Answers more detail:os