function HasRole(role) {
return function(req, res, next) {
if (role !== req.user.role) res.redirect(...);
else next();
}
}
How many parameters you should pass in the middleware function?
Three (3) parameters you should pass in the middleware function. (req,res,next)
app.use((req, res, next) => {
console.log('Time:', Date.now())
next()
})