1.0.1 • Published 9 years ago

derby-error v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

Derby Error

Derby JS middleware that adds default error handling redirects.

For example:

http://site.com/unknown/path => http://site.com/error/404

Why should I use this?

It allows your client app to handle errors the same way you'd handle normal page requests. Simply add a route for /error/:code. Now there's no need to create a static app to handle errors. Of course, you can still do that if you'd like.

Installation

$ npm install derby-error --save

In your server file:

var error = require('derby-error');

expressApp
  // ...
  // ...
  // place after all other middleware
  .use(error());

Usage

Create an error handling route:

// assumes you have views such as: 404.html, 500.html, etc.
app.get('/error/:code', function (page, model, params) {
  page.render(params.code);
});
1.0.1

9 years ago

1.0.0

9 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago