
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
express-healthchecker
Advanced tools
Expose an express service health status.
Install with:
npm install --save express-healthchecker
Write some health checks:
/*
* A healthCheck is an object with the following properties:
* - `name` (stirng): the name of the health check
* - `checkHealth` (function): a function that returns (a promise to) a
* healtResult
*
* A healthResult is an object with the following properties:
* - `isHealthy` (boolean): indicates the health status
* - `details` (any) (optional): contains details about a check
*/
module.exports = {
name: "myHealthCheck",
checkHealth: () => {
return Promise.resolve({
isHealthy: false,
details: "Problems occurred"
});
}
};
Use them in your express app:
const express = require("express");
const {healthRoute} = require("express-healthchecker");
const myHealthCheck = require("src/healthChecks/myHealthCheck");
express()
.get("/health", healthRoute({
healthChecks: [myHealthCheck],
accessToken: process.env.HEALTH_ROUTE_ACCESS_TOKEN
}));
When accessing the /health
resource all checks are run and the resource
responds with:
200 Ok
if the service is healthy (all checks pass)503 Service Unavailable
if the service is unhealthy (some checks fail)The body of the response is a JSON object with property isHealthy
indicating
the health status.
If an access_token
matching the accessToken
passed as option to
healthRoute
is provided in the querystring of the request, additional details
are returned in the response.
Example requests/responses:
GET /health
200 OK
{
"isHealthy": true
}
---
GET /health
503 Service Unavailable
{
"isHealthy": false
}
---
GET /health?access_token=valid_access_token
200 OK
{
"isHealthy": true,
"details": {
"myHealthCheck": {
"isHealthy": true
}
}
}
---
GET /health?access_token=valid_access_token
503 Service Unavailable
{
"isHealthy": false,
"details": {
"myHealthCheck": {
"isHealthy": false,
"details": "Problems occurred"
}
}
}
See CONTRIBUTING.
FAQs
Expose an express service health status
The npm package express-healthchecker receives a total of 24 weekly downloads. As such, express-healthchecker popularity was classified as not popular.
We found that express-healthchecker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.