Skip to content

Update to Express 4.0, Improve Routing & Error Handling

Latest
Compare
Choose a tag to compare
@jesseweed jesseweed released this 14 Apr 06:16
· 76 commits to master since this release

EXPRESS

  • Manually add middleware we need now that Connect is gone (morgan, cookie-parser, body-parser, method-override)
  • app.router is deprecated: update the way routing is handled

ROUTING

  • Routing is now handled in app/routes, config/routes.js is no more.
  • Add 2 new example controllers to highlight how router works (foobar, crud)
  • Updated auto router

ERROR HANDLING

  • Cleaned up & modularized error handling
  • Use next() vs manually writing res.send(404/500/etc) for every error
  • Added new tesla.throw function to make handling HTTP errors easier
  • Errors are now thrown with next(tesla.throw(404)), next(tesla.throw(500)), etc

VIEWS

  • Made index default view instead of default
  • Updated error views for all template languages
  • Updated view for all templates to work better with CLI boilerplate & bower injection