0.0.2 • Published 7 years ago

@martini97/healthcheck-middleware v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

healthcheck-middleware

Build Status
Simple module to check the health status of a service dependencies

Usage

Parameters

  • services: an object mapping the service name to its URL, the service must have a /_ping route.
const express = require('express');
const healthcheck = require('@martini97/healthcheck-middleware').default;

const servicesAllUp = {
  'service-1': 'http://service-1',
  'service-2': 'http://service-2',
  'service-3': 'http://service-3',
  'service-4': 'http://service-4',
};

async function application() {
  const app = express();
  app.use(await healthcheck(servicesAllUp));
  return app;
};

async function start() {
  const app = await application();
  app.listen(3000, () => console.log('http://localhost:3000'));
}

start();