paypal/express-enrouten — pull request #18 by totherik (2014-02-08 20:28:41+00:00)
Title: Reorder after scan to support late registration of middleware.

Previously, reordering of middleware to place routes in a predicable location didn't take into account late registration of middleware. For example, prior to this change if a scanned file did the following, the middleware would be placed AFTER the route handler in the middleware stack. This change ensures it is placed before express' router. Includes test case.

```javascript
// file1.js
module.exports = function (app) {
app.use('/foo', myMiddleware);
app.get('/foo', function (req, res, next) {
res.send('ok');
}
};
```