New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

microhealth

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microhealth

Simple health check for microservices

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created
Source

microhealth

Build Status

A Node.js module for simple health checking. Originally created to add health checks to microservices deployed to our Kubernetes cluster.

Getting started

First, install microhealth using npm:

    npm i microhealth

Then, require the package and use it like so:

    const health = require('microhealth')

    health.register(() => Promise.resolve())
    health.check()
      .then(() => console.log('Healthy!'))
      .catch(() => console.error('Health check failed!'))

API

.register(cb)

Register a health check. This should be a promise which will resolve if check passes or rejects if the check failed.

.check()

Run all checks. Returns a promise. If they all pass will resolve and if any check fails will reject.

.route()

Returns connect/express middleware. Will run .check() and send 200 response if all checks pass and 500 if any check fails.

.getChecks()

Returns an array of all registered health checks.

.reset()

Clears all health checks. Used for testing. Normally you would not call this directly.

Contributing

To report bugs or request features, submit issues here on GitHub, concrete-cc/microhealth/issues. Pull requests are also welcome.

License

MIT

FAQs

Package last updated on 08 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts