Skip to content

Instantly share code, notes, and snippets.

@mihs
Last active December 17, 2015 19:49
Show Gist options
  • Save mihs/5663080 to your computer and use it in GitHub Desktop.
Save mihs/5663080 to your computer and use it in GitHub Desktop.
Working around implicit router in express 3.x ( https://github.com/visionmedia/express/issues/1404 ). Do this after you have loaded your middleware and set up your routes.
# router was automatically added, remove it and add it again at the end
for index, middleware of app.stack
if middleware.handle == app.router
routerAt = index
break
if routerAt
app.stack.splice(routerAt, 1)
app.use(app.router)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment