pull-http-router
Minimal express-like router for pull-streams.
Usage
const pl = const summary = const toPull = const http = var router = routerrouter var server = http server
API
PullHttpRouter
Usage: router = new PullHttpRouter(opts)
Create a new PullHttpRouter.
Accepts an options object with the following optional keys:
- router: Accepts any router object with a match and define method. Defaults to routington
- match: Specify a specific match method for matching routes. Defaults to routington#match
- define: Specify a specific define method for defining routes. Defaults to routington#define
router#route
Usage: router.route(opts)
Create a pull-stream which expects a request object, and returns a readable stream.
pullHttpRouter#get, pullHttpRouter#set, pullHttpRouter#update, pullHttpRouter#post, pullHttpRouter#put, pullHttpRouter#delete, pullHttpRouter#options
Usage: router.get(path, [streams...])
Accepts a path to match on, and a stream to stream to. If multiple pull-streams are provided they will be linked together as if they were passed to pull-stream core's pull()
Installation
$ npm install pull-http-router