Skip to content

Is it possible to avoid next() #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
codemasternode opened this issue Dec 27, 2018 · 0 comments
Open

Is it possible to avoid next() #2

codemasternode opened this issue Dec 27, 2018 · 0 comments

Comments

@codemasternode
Copy link

codemasternode commented Dec 27, 2018

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) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant