http-error-stream

1.0.1 • Public • Published

http-error-stream stability

npm version build status test coverage downloads js-standard-style

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

MIT

Readme

Keywords

Package Sidebar

Install

npm i http-error-stream

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • yoshuawuyts