npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

http-error-stream

1.0.1

@yoshuawuyts

npmHomeRepoSnykSocket
Downloads:4
$ npm install http-error-stream
DailyWeeklyMonthlyYearly

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