Call Javascript function with no argument and no default argument defined
From example here:
https://github.com/jaredhanson/passport-facebook/blob/master/examples/login/app.js#LC75
app.get('/account', ensureAuthenticated, function(req, res){
res.render('account', { user: req.user });
});
function ensureAuthenticated(req, res, next) {
if (req.isAuthenticated()) { return next(); }
res.redirect('/login')
}
I don't understand how ensureAuthenticated works. It requires 3 arguments,
no default argument is set. But if I call it with no argument (in
app.get), it does execute correctly, how could this be?
No comments:
Post a Comment