Skip to content

Instantly share code, notes, and snippets.

@dashersw
Last active May 9, 2017 07:36
Show Gist options
  • Save dashersw/c1f8689635cf820910b6170bfb8de6c7 to your computer and use it in GitHub Desktop.
Save dashersw/c1f8689635cf820910b6170bfb8de6c7 to your computer and use it in GitHub Desktop.
Hassle-free microservices with cote.js — arbitration-service.js
const cote = require('cote');
const responder = new cote.Responder({ name: 'arbitration API', key: 'arbitration' });
const publisher = new cote.Publisher({ name: 'arbitration publisher' });
const rates = {};
responder.on('update rate', (req, cb) => {
rates[req.currencies] = req.rate;
cb('OK!');
publisher.publish('update rate', req);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment