TryGhost/Ghost — pull request #2603 by hswolff (2014-04-17 04:51:51+00:00)
Title: Upgrade to Express 4.0

no related issue

- Updates package.json packages, adding express middleware packages
that have been broken into their own modules

- Updates controllers/frontend.js to use the new Layer object that Express 4.0
has. Requires some monkey-patching as the Layer object isn't explicitly
surfaced, however it should be safe to do.

- Moved the setup of routes into middleware/index.js because they need to
be added as a middleware function before the 404 and 500 handlers. This is
no longer possible with the old app.use(app.router) as that has been removed.

- Cleaned up middleware/index.js to make it compatible with Express 4.0.

- Simplified the way themes are activated and enabled when they are activated.
The new handling is simpler, yet should still cover all the use cases that
previously existed.

- The entire flow of activating a theme through middleware should be a little
more centralized, letting it be easier to read and maintain.

- Moved every routes/*.js file to use an individual express.Router() instance.