Serviced

Microservice dependency readiness probe
Small utility to probe for backing-service availability using http calls and promises. This will likely evolve to be more compatible but, for now, it uses features available in Node 6+. Feel free to send pull requests or open issues to make it compatible with earlier versions.
I use this to ensure I don't start certain processes (for example, our API server) before the backing services (db, message broker and kubernetes api) are up, running and reachable. Internally serviced
uses backoff
and request
for http calls and retries.
Usage
npm i serviced
const Serviced = require('serviced');
const service1 = {
name: 'db',
url: 'http://db',
json: true,
maxDelay: 1000,
numberOfBackoffs: 10,
test(body) {
return body.foo === true;
},
};
const service2 = {
name: 'kubernetes',
url: 'http://localhost:8080',
test(body) {
return body.bar === true;
},
};
const services = new Serviced(service1, service2);
services.then(() => {
});