500
v0.0.0
Published
Generate 500 response errors.
Downloads
5
Readme
500
Easily generate 500 HTTP responses. I found my self writing this logic over and over again, so it's extracted out in to a module.
Installation
npm install --save 500
Usage
'use strict';
var fivehundered = require('500')
, http = require('http');
var server = http.createServer(function (req, res) {
res.statusCode = 200;
if (Math.random()) return fivehundered('Server failed because of reasons');
else if (Math.random()) return fivehundered(new Error('Random error'));
res.end('hello world');
}).listen(8080);
License
MIT