tribune

1.3.0 • Public • Published

Tribune

Holy advocate to the Roman Senate, your Tribune will ensure the Consuls have your interests in mind.

CircleCI Coverage Status bitHound Overall Score bitHound Dependencies bitHound Dev Dependencies bitHound Code

Tribune is a module designed to register and discover services with Consul.

Registering a service

const Tribune = require('./lib/tribune');
const tribune = new Tribune({ agentUrl: 'http://localhost:8500' });
 
tribune.register('api-server', {
  url       : 'http://localhost:8000',
  statusPath: 'http://localhost:8000/status',
  interval  : 2000
}, (err) => {
  ...
});

As you can see it's quite easy to get started with Tribune. When Tribune registers your service it will automatically remove ghosts of the service. This means that you won't have to manually remove duplicates of your service created each time your service starts up.

Making a request to a service

const Tribune = require('tribune');
const tribune = new Tribune({ agentUrl: 'http://localhost:8500' });
tribune.service('api-server').post('/article', { json: {...} }, (err, res) => {
  ...
});

When you request access to a service Tribune will pick a random

API Documentation

Package Sidebar

Install

npm i tribune

Weekly Downloads

0

Version

1.3.0

License

MIT

Last publish

Collaborators

  • robertwhurst