1.0.1 • Published 4 years ago

express-health-middleware v1.0.1

Weekly downloads
29
License
MIT
Repository
github
Last release
4 years ago

Express Health Middleware

This middleware adds four useful API's to monitor the express application.

Installation

$ npm install --save express-health-middleware

Usage

const app = express();
const expressHealth = require('express-health-middleware');

app.use(expressHealth());

or 

app.use('/basePath', expressHealth());

API's

APIDescription
/aboutReturns application information.
/healthReturns 200 status code.
/memory-usageReturns Memory usage of application.
/uptimeReturns application running time.

API Sample Responses

/about

NOTE: 1. Returns data from package.json. 2. Without package.json '/about' will returns application default 404 page.

{
    "name":"My App",
    "description":"App Description",
    "version":"1.0.0",
    "author":"Mr.XYZ",
    "license":"MIT",
    "homepage":"homepage url"
}

/health

OK

/memory-usage

{
    "rss":"25.28 MB",
    "heapTotal":"8.79 MB","
    heapUsed":"6.58 MB",
    "external":"1.31 MB",
    "arrayBuffers":"25.77 KB"
}

/uptime

{ "uptime" : "00:16:49" }

License

MIT