Health Checks
![codecov](https://codecov.io/gh/MiffyLiye/HealthChecksJS/branch/master/graph/badge.svg)
A generic health checker.
Getting Started
Install it via npm:
npm install @miffyliye/health-checks
Include in your project:
var { HealthChecker, HealthStatus } = require('@miffyliye/health-checks');
const healthChecker = new HealthChecker();
healthChecker.addCheck(async () => {
if (Math.random() > 0.5) {
throw new Error('RandomFailure');
}
}, 'db', HealthStatus.Unhealthy.name, ['default', 'all']);
healthChecker.addCheck(async () => {
if (Math.random() > 0.5) {
throw new Error('RandonFailure');
}
}, 'external-service', HealthStatus.Degraded.name, ['all']);
var res = await healthChecker.getStatus();
var res = await healthChecker.getStatus('all');
License
MIT