1.0.1 • Published 8 years ago
http-error-stream v1.0.1
http-error-stream
Stream an error over http. Takes a server-error
error and streams it back
out.
Usage
const errorStream = require('http-error-stream')
const serverError = require('server-error')
const bole = require('bole')
const http = require('http')
const log = bole('my-service')
const error = serverError(log)
http.createServer(function (req, res) {
const err = error.client('oh no!')
// set statusCode, content-type and stream error as JSON
errorStream(req, res, err).pipe(res)
}).listen
Installation
$ npm install http-error-stream
License
1.0.1
8 years ago