express middleware for errorable
Installation
$ npm install --save errorable-express
API
- res.errors
Keeps all errors defined, like res.errors.Success. - res.errorize/res.restify
Generate the json object for the error and insert data if possible
Usage
Expressjs Middleware
var errorableExpress = ;var common = ;var errorable = ;var Generator = errorableGenerator;var errors = common 'zh-CN'errors; express; express;express; express; express;
Integration with Sailsjs
in config/http.js
//Create a new middleware function { var errorableExpress = ; //the errorable middleware for express var common = ; //the errorable middleware for express var errorable = ; //the errorable library var Generator = errorableGenerator; //Get the generator var errors = common 'zh-CN'errors; //Generate the errors var callback = ; ; } //Added it to the order array order: ... 'errorable' ...
License
MIT © calidion