hi, all

Errorable is ready for integration with expressjs.

Errorable is a try to solve problems in defining, migrating, exchanging of
errors between projects or companies .

1. Errorable can be easily defined according to very simple rules.
2. Errorable can be easily expand to more than one languaes
3. Errorable can be easily customized to your own needs and can easily get
what is predefined.

the errorable project is here:
https://github.com/calidion/errorable

currently available errors are:
1. http errors
https://github.com/Errorable/http
2.  common errors
https://github.com/Errorable/common


the expressjs middleware is here:
https://github.com/Errorable/express-middleware


the following code shows how it works.

var errorableExpress = require('errorable-express');   //the errorable
middleware for expressvar common = require('errorable-common');
//predefined or customized errorsvar errorable =
require('errorable');        //the errorable libraryvar Generator =
errorable.Generator;         //Get the generatorvar errors = new
Generator(common, 'zh-CN').errors;    //Generate the errors
express.use(errorableExpress(errors));             //added errorable
to expressjs as a middleware
express.get('/', function indexxx(req, res) {
  res.restify(res.errors.Success);                //We get extended
res object with new apis and the errors attribute.
});express.get('/message', function messagexx(req, res) {
  res.restify(res.errors.Success, message);
});
express.get('/unknown', function unknownxx(req, res) {
  res.restify();
});
express.get('/errorize', function errorizexx(req, res) {
  //restify === errorize
  res.errorize();
});

Thanks & enjoy.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAKEKHHZkmj9bhR%2BDrcMKPX2oVA5tihwuLV3rJ3LF74kq_1O4PQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to