Http pull-stream functions. Useful for composing middleware in high throughput servers.
Usage
const serverRouter = const summary = const browserify = const pullHttp = const logHttp = const pull = const bankai = const bole = const http = const path = const clientp = pathconst log = { bole const router = const server = http server} { const router = router router router return router}
API
pullHttp.createSource(req, res)
Create a new source stream from an HTTP request. Attempts to parse JSON if
content type is application/json
.
pullHttp.createSink(req, res)
Creates a new sink stream. Sends errors if an error is detected. Sends JSON if
any data is passed. If no data is passed, it acts as a noop sink, expecting an
earlier stream to handle res.end()
.
pullHttp.intercept(httpFn) -> routerFn(req, res, params, setSize)
Wrap a Node stream behind a router to send data, and handle its own res.end()
call. [more docs tbi]
Installation
$ npm install pull-http