Skip to content

Is it possible to avoid next() #2

Description

@codemasternode
router.route('/auth/facebook')
  .post(passport.authenticate('facebook-token', {session: false}), function(req, res, next) {
    if (!req.user) {
      return res.send(401, 'User Not Authenticated');
    }
    // prepare token for API
    req.auth = {
      id: req.user.id
    };
    next();
  }, generateToken, sendToken);

I mean third argument of method post (function(req,res,next)), and of course render response in this function. And avoid adding fourth and fifth argument (generateToken, sendToken) ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions