title: Express: can I use multiple middleware in a single app.use?
body: <p>I have a lot of apps full of boilerplate code that looks like this:</p>
  
  <pre><code>app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(cookieParser());
  app.use(require('express-session')({
          secret: 'keyboard cat',
          resave: false,
          saveUninitialized: false
  }));
  app.use(passport.initialize());
  app.use(passport.session());
  </code></pre>
  
  <p>How can I use multiple middleware at once? So I could turn the above into:</p>
  
  <pre><code>// Some file, exporting something that can be used by app.use, that runs multiple middlewares
  const bodyParsers = require('body-parsers.js')
  const sessions= require('sessions.js')
  
  // Load all bodyparsers
  app.use(bodyParsers)
  
  // Load cookies and sessions
  app.use(sessions)
  </code></pre>