Q:

use express.bodyParser() and passport.js

I'm working on a node server using express.js and passport.js. I'm in a condition, in which I don't want to use the express.bodyParser() before app.use(passport.initialize()) and app.use(passport.session()). If I do a app.use(express.bodyParser()) after the two passport middleware functions, they kind of mess up the req-stream and the bodyParser does not work anymore.
I want to use the bodyParser only in a few particular routes and not in the whole app. What I did to circumvent this error is the following (in every route I want to secure and use the bodyParser):
app.post(route, express.json(), passport.initialize(), passport.session(), isAuthenticated, controller);
But I think that's kind of nasty. Is there a solution to keep it DRY?

A:

auth.js
var passport = require('passport');
var express = require('express');
function isAuthenticated(req, res, next) {
  //...
}
module.exports = [
  express.json(),
  passport.initialize(),
  passport.session(),
  isAuthenticated
];

somerouter.js
app.post(route, require('./auth'), controller);

