0.0.2 • Published 6 years ago

loopback-healthcheck-middleware v0.0.2

Weekly downloads
39
License
MIT
Repository
github
Last release
6 years ago

loopback-healthcheck-middleware

A loopback middleware to install an route that returns basic server status.

Install

  npm install loopback-healthcheck-middleware --save

How to use

Add the middleware to your middleware.json:

{
  "routes:before": {
    "loopback-healthcheck-middleware": {}
  }
}

Or registered via loopback API, e.g. /server/server.js:

var loopback = require('loopback');
var hcmw = require('loopback-healthcheck-middleware');

var app = loopback();

app.middleware('routes:before', hcmw({ versionFile: './package.json' }));

Configuration

options.path

string that used as route path, default value is /health

options.versionFile

string that used as relative path for the json file has version defined, default value is ../../package.json, which is the path relative to <project_path>/node_modules/loopback-healthcheck-middleware/healthcheck.js