0.0.99 • Published 7 years ago

simple-health v0.0.99

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

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.

0.0.99

7 years ago

0.0.98

7 years ago

0.0.97

7 years ago

0.0.96

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago