I'm trying to include a middleware (passport-http-bearer) in MEAN.js, however it uses a different routing syntax than Express 4.
Express API sytnax is:
app.get('/', function(req, res){
res.send('hello world');
});
In MEAN.js routes are defined like this:
app.route('/articles')
.get(articles.list)
.post(users.requiresLogin, articles.create);
How do I include a middleware in the MEAN.js router (in my case passport-http-bearer to check for a token)?
http-bearer's example implementation as middleware is:
app.get('/profile',
passport.authenticate('bearer', { session: false }),
function(req, res) {
res.json(req.user);
});
How should I do this in MEAN.js?