New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-healthcheck

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-healthcheck

Super-simple healthcheck middleware for express

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

express-healthcheck

Super-simple healthcheck middleware for express

Installation

npm install express-healthcheck

Usage

app.use('/healthcheck', require('express-healthcheck')());

This will respond with a JSON payload of { "uptime": [uptime in seconds] } and a 200 status code.

The healthy response can be customised by passing in a custom healthy method.

app.use('/healthcheck', require('express-healthcheck')({
    healthy: function () {
        return { everything: 'is ok' };
    }
}));

You can optionally provide a test method which will be executed to establish the health of the application.

This function can either throw, return an error, or call a callback with an error. Functions with an arity of 0 will expect a return, functions with an arity of 1 will expect a callback.

app.use('/healthcheck', require('express-healthcheck')({
    test: function () {
        throw new Error('Application is not running');
    }
}));
app.use('/healthcheck', require('express-healthcheck')({
    test: function () {
        return { state: 'unhealthy' };
    }
}));
app.use('/healthcheck', require('express-healthcheck')({
    test: function (callback) {
        callback({ state: 'unhealthy' });
    }
}));

FAQs

Package last updated on 01 Mar 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc