title: How to write clean, modular express.js applications
body: <p>Pretty much since forever, I've stayed away from NodeJS backend development for one reason and one reason only: Almost all Express projects I've started or I've been forced to maintain end up being a huge mess where the entire website is run on a single script that's +/- 5000 lines long.</p>
  
  <p>The the following example from the ExpressJS hello world page, in this form I'd end up adding more and more routes to <code>app</code> leading to a huge mess of code.</p>
  
  <pre><code>var express = require('express');
  var app = express();
  
  app.get('/', function (req, res) {
      res.send('Hello World!');
  });
  
  app.listen(3000, function () {
      console.log('Example app listening on port 3000!');
  });
  </code></pre>
  
  <p>What I can't seem to find, is how I could take a large express website, and turn it into a <strong>modular</strong> application where routes are <strong>small</strong>, <strong>re-usable</strong> and <strong>easily testable</strong>. If anyone has any idea of how to do this it would be greatly appreciated.</p>