digger-supplychain

0.4.4 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i digger-supplychain

Weekly Downloads

0

Version

0.4.4

License

MIT

Last publish

Collaborators

  • binocarlos