I'm having trouble understanding whats going on with the custom callback for Passport.js. I don't understand the (req, res, next)
at the end. Should we have these values from closure?
app.get('/login', function(req, res, next) {
passport.authenticate('local', function(err, user, info) {
if (err) { return next(err); }
if (!user) { return res.redirect('/login'); }
req.logIn(user, function(err) {
if (err) { return next(err); }
return res.redirect('/users/' + user.username);
});
})(req, res, next); //<=== What is the purpose of this?
});