tribune
v1.3.0
Published
Holy advocate to the Roman Senate, your Tribune will ensure the Consuls have your interests in mind.
Downloads
11
Maintainers
Readme
Tribune
Holy advocate to the Roman Senate, your Tribune will ensure the Consuls have your interests in mind.
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