
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
health-checking-service
Advanced tools
This is a Node package that allows you to track the health of your application, providing two ways of checking:
Simple: will respond to a JSON as below and that allows you to check if your application is online and responding without checking any kind of integration.
{
"status": "pong"
}
Detailed: will respond a JSON as below and that allows you to check if your application is up and running and check if all of your integrations informed in the configuration list is up and running.
{
"name": "example",
"version": "v1.0.0",
"status": false,
"date": "2022-09-23T07:26:51.369Z",
"duration": 0.221,
"integrations": [
{
"name": "local-redis",
"type": "Redis integration",
"url": "xxxxxxxxxxxx",
"status": 200,
"responseTime": 0.006
},
{
"name": "ui api service",
"type": "Web service integration",
"url": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"status": 403,
"responseTime": 0.215,
"error": {
"action_type": 2,
"error": 90309999,
"is_customized": false
}
},
{
"name": "local-timescale",
"type": "Database integration",
"url": "xxxxxxxxxxxx",
"status": 200,
"responseTime": 0.044,
"dialect": "postgres"
},
{
"name": "local-postgres",
"type": "Database integration",
"url": "xxxxxxxxxxxx",
"status": 200,
"responseTime": 0.162,
"dialect": "postgres"
},
{
"name": "dev-mariadb",
"type": "Database integration",
"url": "xxxxxxxxxxxx",
"status": 200,
"responseTime": 0.157,
"dialect": "mariadb"
},
{
"name": "staging-mysql",
"type": "Database integration",
"url": "xxxxxxxxxxxx",
"status": 200,
"responseTime": 0.22,
"dialect": "mysql"
},
{
"name": "local-sqlite",
"type": "Database integration",
"status": 200,
"responseTime": 0.004,
"dialect": "sqlite"
},
{
"name": "dev-sqlite",
"type": "Database integration",
"status": 200,
"responseTime": 0.004,
"dialect": "sqlite"
},
{
"name": "minio",
"type": "Object storage integration",
"url": "xxxxxxxxxxxxxxxxxxxxxxx",
"status": 200,
"responseTime": 0.131,
"dialect": "minio"
},
{
"name": "s3",
"type": "Object storage integration",
"url": "xxxxxxxxxxxxxxxxxxxxxxx",
"status": 200,
"responseTime": 0.133,
"dialect": "aws"
}
]
}
npm i health-checking-service
Example using Nodejs + Express
const express = require('express');
const {
detailChecking, simpleChecking, healthType, healthDialect,
} = require("health-checking-service");
const app = express();
app.get('/health-check/', (req, res) => {
res.json({ status: "I'm alive!" });
})
app.get('/health-check/liveness', (req, res) => {
res.json(simpleChecking())
})
app.get('/health-check/readiness', async (req, res) => {
const result = await detailChecking({
name: "example",
version: "v1.0.0",
integrations: [
{
type: healthType.REDIS,
name: "local-redis",
host: "xxxxxxxxxx",
port: 6379,
},
{
type: healthType.WEB_SERVICE,
name: "api service",
host: "https://xxxxxxxxxxx/",
headers: [
{ key: "Accept", value: "application/json" },
{
key: "Authorization",
value: "Bearer ey......",
},
],
},
{
type: healthType.DATABASE,
name: "local-postgres",
host: "xxxxxxxxxx",
port: 5432,
dbName: "xxxxxxxxxx",
user: "xxxxxxxxxx",
password: "xxxxxxxxxx",
dialect: healthDialect.DATABASE.postgres,
},
{
type: healthType.DATABASE,
name: "local-mariadb",
host: "localhost",
port: 3306,
dbName: "xxxxxxxxxx",
user: "xxxxxxxxxx",
password: "xxxxxxxxxx",
dialect: healthDialect.DATABASE.mariadb,
},
{
type: healthType.DATABASE,
name: "local-mariadb",
host: "localhost",
port: 3306,
dbName: "xxxxxxxxxx",
user: "xxxxxxxxxx",
password: "xxxxxxxxxx",
dialect: healthDialect.DATABASE.mysql,
},
{
type: healthType.DATABASE,
name: "local-sqlite",
filename: "path to .sqlite file",
dialect: healthDialect.DATABASE.sqlite,
},
{
type: healthType.OBJECT_STORAGE,
name: "minio",
endPoint: "xxxxxxxxxx",
accessKey: "xxxxxxxxxx",
secretKey: "xxxxxxxxxx",
dialect: healthDialect.OBJECT_STORAGE.minio,
},
{
type: healthType.OBJECT_STORAGE,
name: "s3",
endPoint: "xxxxxxxxxx",
accessKey: "xxxxxxxxxx",
secretKey: "xxxxxxxxxx",
region: "xxxxxxxxx",
dialect: healthDialect.OBJECT_STORAGE.aws,
},
{
type: healthType.CUSTOM,
name: "custom",
checking: async () => {
// do some thing
return {
status: 200, // || 500
responseTime: 0,
error: "",
};
},
},
],
});
res.json(result);
})
app.listen(3000, () => {
console.log('server started at port 3000')
})
FAQs
health checker for node and can custom
The npm package health-checking-service receives a total of 1 weekly downloads. As such, health-checking-service popularity was classified as not popular.
We found that health-checking-service 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
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.