in the passport [configure authentication] documentation, it has a rather scary-looking function that uses the mysterious function done.'
passport.use(new LocalStrategy(
function(username, password, done) {
User.findOne({ username: username }, function (err, user) {
if (err) { return done(err); }
if (!user) {
return done(null, false, { message: 'Incorrect username.' });
}
if (!user.validPassword(password)) {
return done(null, false, { message: 'Incorrect password.' });
}
return done(null, user);
});
}
));
Now, in the express documentation there are quite a few methods that pass something called next.
app.use(function(err, req, res, next){
console.error(err.stack);
res.status(500).send('Something broke!');
});
Is this the difference between the two frameworks, express and passport? Or are they doing two separate things?