Skip to content

Unable to run handler function in /:id route #28

Open
@ghost

Description

I've ran into a problem that works on a "regular" route ('/') but not on one at /:id.

passport.authenticate('bearer', { session: false }, function(err, user, info) {
if (user)
// check user's role for premium or not
if (user.role == "premium" || user.role == "editor" || user.role == "moderator" || user.role == "admin")
return ArticleModel.find(function (err, articles) {
return res.send(articles);
});
else
return ArticleModel.find(function (err, articles) {
var response = articles.filter(stripOutPremium);
return res.send(response);
});
else
// return items even if no authentication is present
return ArticleModel.find(function (err, articles) {
var response = articles.filter(stripOutPremium);
return res.send(response);
});
})(req, res, next);

Will just sit and spin forever, I get no response. I can't get the passport.authenticate('bearer'... function to run at all.

Any idea why something like this works on a simple route like app.get('/') and not app.get('/:id')?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions