Warehouse routing for digger-client requests.
$ npm install digger-server
Make a digger-level supplier and mount it.
var level = ;var diggerserver =var diggerlevel =// create a new leveldb - this can also be a sub-levelvar leveldb =// create a level digger suppliervar supplier =// create a digger server to mount our level suppliervar digger =// mount the level supplier onto the serverdigger// access controldigger// create a HTTP server to host itvar server = httpserver
The digger server accepts HTTP requests that have been converted to JSON objects.
req is a read-stream in object mode with the following properties:
You can convert raw HTTP requests using digger-http.
Here are the notable endpoints:
The first 3 are used for contract resolving - a contract is a complicated multi-step selector / append / save / delete request.
The ship endpoint accepts a contract as its POST data and expects the body of each contract to be present.
The stream endpoint accepts a contract in its x-digger-contract header and will stream the requests input to that contract.
This creates selector streams for each of the selector stages and pipes them accordingly.
The input is not JSON packets but context paths.
This is the REST controller back to the storage engine - you can call standard HTTP on this (for example to load a single container just GET its url)