title: What is "done" callback function in Passport Strategy Configure "use" function
body: <p>I'm an node.js and express.js noob. This question may seems silly but I'm really in confusion.</p>
  
  <p>I'm trying to configure <a href="https://github.com/jaredhanson/passport-local">Local Strategry</a> authentication by using <a href="http://passportjs.org/">passport</a>. As shown in the official documentation, we can figure this Local Strategy by the following code,</p>
  
  <pre><code>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); }
        if (!user.verifyPassword(password)) { return done(null, false); }
        return done(null, user);
      });
    }
  ));
  </code></pre>
  
  <p>My confusion is about the <code>done</code> callback function. When the official docs show this local strategy using as a middleware in the route handler, there is no need to pass the function parameter for this <code>done</code> callback.</p>
  
  <pre><code>app.post('/login', 
    passport.authenticate('local'),
    function(req, res) {
      res.redirect('/');
    });
  </code></pre>
  
  <p>So, isn't this <code>done</code> callback function will be null if we don't provide the function parameter? If not, what is that <code>done</code> callback function and what processes will be happening in this <code>done</code> callback function?</p>