title: Express JS res.redirect is undefined
body: <p>I follow this <a href="https://hackhands.com/mongodb-crud-mvc-way-with-passport-authentication/" rel="nofollow">tutorial</a> on how to use passport-facebook in MEAN stack, I got this error when I try to use <code>res.redirect('/signup')</code> I always get this error: <code>ReferenceError: res is not defined</code></p>
  
  <p>it seems like I didn't pass <code>res</code> as a parameter in my function. I try to add it at second / last parameters. but nothing works. What do I miss???</p>
  
  <p>Here is my code:</p>
  
  <pre><code>exports.saveOAuthUserProfile = function(req, profile, done){
      User.findOne({
          provider: profile.provider,
          providerId: profile.providerId,
      },
      function(err, user) {
          if (err) {
              return done(err);
          }
          else
          {
              if (!user) {
                  // console.log(profile.email.value);
                  var possibleUsername = profile.username || ((profile.email) ? profile.email.value.split('@')[0] : '');
                  User.findUniqueUsername(possibleUsername, null, function(availableUsername){
                      profile.username = availableUsername;
                      user = new User(profile);
  
                      user.save(function(err){
                          if (err) {
                              var message = getErrorMessage(err);
                              // var message = _this.getErrorMessage(err);
                              req.flash('error', message);
                              return res.redirect('/register');
                          }
  
                          return done(err, user);
                      });
                  });
              }
              else
              {
                  return done(err, user);
              }
          }
      });
  };
  </code></pre>