sh

simple-health

Simple middleware module for health cheking

Showing:

Popularity

Downloads/wk

1

Maintenance

No Maintenance Data Available

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Simple-Health

Simple middleware module for health cheking.

Install with npm:

$ npm install simple-health --save

Quick start

Import npm module:

const SimpleHealth = require('simple-health');

Configure:

let health = new SimpleHealth({
    data: [
        {key: 'name', value: 'module_name', public: true}
    ]
});

Initialize middleware:

app.use( health );

Follow the link:

http://YOUR_HOST/health

Config

limit - timeout for response in milliseconds (1000)

url - URL for request ('/health')

headers - object with response headers

data - array with settings for response object

Data config:

key - field key

value - field value (simple type, function or Promise)

public - show field without apikey

promise - for promise function

Example

{
    key: 'date',
    value: (new Date).getTime()
},
{
    key: 'alive',
    value: function () {
         return (new Date).getTime() - this.result.date
    }
},
{
    key: 'reportsLink',
    value: function() {
        return new Promise((success, fail)=>{
            setTimeout(()=>success(true), 700);
        })
    },
    promise: true
}

Use this.result to access other keys of response object.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100