Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yoshuawuyts/http-error-stream
Stream an error over http
https://github.com/yoshuawuyts/http-error-stream
Last synced: about 1 month ago
JSON representation
Stream an error over http
- Host: GitHub
- URL: https://github.com/yoshuawuyts/http-error-stream
- Owner: yoshuawuyts
- License: mit
- Created: 2016-03-29T08:42:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-03-29T08:48:03.000Z (over 8 years ago)
- Last Synced: 2024-09-26T20:24:41.143Z (about 1 month ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# http-error-stream [![stability][1]][1]
[![npm version][2]][3] [![build status][4]][5] [![test coverage][6]][7]
[![downloads][8]][9] [![js-standard-style][10]][11]Stream an error over http. Takes a `server-error` error and streams it back
out.## Usage
```js
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
```sh
$ npm install http-error-stream
```## License
[MIT](https://tldrlegal.com/license/mit-license)[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square
[1]: https://nodejs.org/api/documentation.html#documentation_stability_index
[2]: https://img.shields.io/npm/v/http-error-stream.svg?style=flat-square
[3]: https://npmjs.org/package/http-error-stream
[4]: https://img.shields.io/travis/yoshuawuyts/http-error-stream/master.svg?style=flat-square
[5]: https://travis-ci.org/yoshuawuyts/http-error-stream
[6]: https://img.shields.io/codecov/c/github/yoshuawuyts/http-error-stream/master.svg?style=flat-square
[7]: https://codecov.io/github/yoshuawuyts/http-error-stream
[8]: http://img.shields.io/npm/dm/http-error-stream.svg?style=flat-square
[9]: https://npmjs.org/package/http-error-stream
[10]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[11]: https://github.com/feross/standard