
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
@hmcts/nodejs-healthcheck
Advanced tools
A library for adding reform standard compliant healthchecks to nodejs applications.
It exposes 3 endpoints:
/health
- Returns 200 by default along with buildInfo
, can optionally include result evaluating all checks
passed in config./health/liveness
- Returns 200 always./health/readiness
- Returns 200 by default , can optionally include result evaluating all readinessChecks
passed in config.Configure an express.js handler with checks.
const config = {
checks: {
mySimpleWebCheck: healthcheck.web("https://example.com/status"),
myComplexWebCheck: healthcheck.web("https://example.com/other", {
callback: (err, res) => {
return res.body.status == "good" ? healthcheck.up() : healthcheck.down()
},
timeout: 5000,
deadline: 10000,
}),
myRawCheck: healthcheck.raw(() => {
return myInternalCheck() ? healthcheck.up() : healthcheck.down()
})
},
buildInfo: {
myCustomBuildInfo: "yay"
}
};
healthcheck.addTo(app, config);
You can optionally include readiness checks.
const config = {
checks: {
mySimpleWebCheck: healthcheck.web("https://example.com/status"),
myComplexWebCheck: healthcheck.web("https://example.com/other", {
callback: (err, res) => {
return res.body.status == "good" ? healthcheck.up() : healthcheck.down()
},
timeout: 5000,
deadline: 10000,
}),
myRawCheck: healthcheck.raw(() => {
return myInternalCheck() ? healthcheck.up() : healthcheck.down()
})
},
readinessChecks: {
mySimpleWebCheck: healthcheck.web("https://example.com/status")
},
buildInfo: {
myCustomBuildInfo: "yay"
}
};
healthcheck.addTo(app, config);
Based on above, you should include a dependency into readiness checks only if they are exclusive/hard dependencies for your service. Unavailability of soft dependencies needs to be handled in code to give appropriate customer experience.
Good example for check to be included in readiness:
Redis
or Elastic Search
which are exclusive to the application (not shared).Bad example for check to be included in readiness:
Bump the version (SemVer) and create a release in the GitHub UI, Travis CI will then build test and release to the npm registry.
Run yarn install (if packages not downloaded) and then run yarn test to run unit tests
FAQs
Healthcheck endpoint for Reform nodejs applications
The npm package @hmcts/nodejs-healthcheck receives a total of 3,666 weekly downloads. As such, @hmcts/nodejs-healthcheck popularity was classified as popular.
We found that @hmcts/nodejs-healthcheck demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 16 open source maintainers 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
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.