express-health-middleware

This middleware helps to add endpoints to monitor the express applications

Usage no npm install needed!

<script type="module">
  import expressHealthMiddleware from 'https://cdn.skypack.dev/express-health-middleware';
</script>

README

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

API Description
/about Returns application information.
/health Returns 200 status code.
/memory-usage Returns Memory usage of application.
/uptime Returns 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