Socket
Book a DemoInstallSign in
Socket

@spokedev/healthchicken

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spokedev/healthchicken

[![pipeline status](https://gitlab.spokedev.xyz/products/marketplace/healthchicken/badges/master/pipeline.svg)](https://gitlab.spokedev.xyz/products/marketplace/healthchicken/commits/master) [![coverage report](https://gitlab.spokedev.xyz/products/marketp

0.0.9
latest
Source
npmnpm
Version published
Maintainers
2
Created
Source

healthchicken

pipeline status coverage report

Healthchicken is express middleware that binds routes to ${serviceName}/healthcheck/ping and ${serviceName}/healthcheck/ready. By default, if the app is healthy, these will always return 200 statuscodes and a {message: 'OK'} json body. You can also specify dependent services. These will be pinged by the ready route. If they are all good, the ready route will return a 200 else you are getting a 500.

Install

$ npm i @spokedev/healthchicken

Usage

Basic usage

const healthchicken = require("healthchicken");
const express = require("express");

const app = express();

app.use(healthchicken({
  serviceName: "cats_n_chickens"
}))

// we now have routes at `cats_n_chickens/healthcheck/ready` and `cats_n_chickens/healthcheck/ping`

Specifying dependent services

const healthchicken = require("healthchicken");
const express = require("express");

const app = express();

app.use(healthchicken({
  serviceName: "cats_n_chickens",
  dependentUrls: ["http://some-other.service"]
}))

// `cats_n_chickens/healthcheck/ready` will now ping `http://some-other.service/healthcheck/ping`
// and fail if it doesn't get a 2xx back.

Using a different prefix

const healthchicken = require("healthchicken");
const express = require("express");

const app = express();

app.use(healthchicken({
  serviceName: "cats_n_chickens",
  prefix: "deathwatch"
}))

// we now have routes at `cats_n_chickens/deathwatch/ready` and `cats_n_chickens/deathwatch/ping`

Adding in version

If the version is found as an environment variable as SERVICE_VERSION then it will be output as part of the ready healthcheck.

FAQs

Package last updated on 22 Nov 2023

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.