Express middleware dependency simplifier


With Express 4.x, each middleware item has become it's own module. While the reasons for separating them is clear, the standard developer flow is still to include the base set provided by the express team here. Adding many of these to your package.json is a pretty significant amount of bloat to me, and since I tend to use the same modules between projects, I decided to create a module to manage the modules and versions.


var express = require('express'),
    expressConfigurator = require('express-configurator');
var app = express();
expressConfigurator.init(app, [
  // Add middleware by name and get the default config
  // Or use an object to provide your own config
  { name: 'morgan', config: 'dev' },
  // You can also provide the 'context' param
  // app.use('/static', serveStatic('./static'))
  { name: 'serve-static', config: './static', context: '/static' },
  // For more complex configurations, you can use submodules.
  // The example shown here is body parser, which is typically represented as 
  // express.use(bodyParser.json());
  // express.use(bodyParser.urlEncoded({ extended: true });
    name: 'body-parser',
        submodules: [
          { name: 'urlencoded', config: { extended: true } }


  • Defaults aren't actually provided yet, just an empty object for now
  • Some tests around things would be good
  • Check that all the standard modules are being used. Specifically I think cookie-parser is deprecated.