digger-supplychain

The supply chain wrapper for digger.io transport layers

npm install digger-supplychain
55 downloads in the last week
113 downloads in the last month

digger-supplychain

Build status

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

npm loves you