digger-supplychain
v0.4.4
Published
The supply chain wrapper for digger.io transport layers
Downloads
19
Readme
digger-supplychain
Interface for digger-contracts to be sent to the server and respond with a digger-container
install
as a node module:
$ npm install digger-contracts
or in the browser using browserify
example
var supplychain = new SupplyChain();
supplychain.on('request', function(req, reply){
req.method.should.equal('post');
req.url.should.equal('/myapi/select');
req.headers['x-json-selector'].tag.should.equal('hello');
reply(null, [{
_digger:{
tag:'fruit',
class:['citrus']
}
}]);
})
var container = supplychain.connect('/myapi');
container.diggerurl().should.equal('/myapi');
var contract = container('hello');
contract.ship(function(results){
results.tag().should.equal('fruit');
results.hasClass('citrus').should.equal(true);
done();
})
licence
MIT