DeferredHTTPStatuses
A quick promise wrapper and helper for http status codes
Install
npm install deferred-http-statuses --save
Use
var deferred = require('deferred-http-statuses');
return deferred(function (resolve, reject, promise) {
if (err) {
reject.badRequest(err);
} else {
resolve.success();
});
Methods
// 200s
success,
created,
accepted,
noContent,
partialContent
// 400s
badRequest,
unauthorized,
paymentRequired,
forbidden,
notFound,
methodNotAllowed,
conflict,
gone,
// 500s
internalServerError,
notImplemented,
badGateway,
serviceUnavailable,
gatewayTimeout
// Exposure
reject: reject,
resolve: resolve