nest-js-hc
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

Nest js Health Check



What is a health check?

Healthchecks are crucial when it comes to complex backend setups. In a nutshell, a health check in the realm of web development usually consists of a special address, for example, https://my-website.com/health/readiness.

A service or a component of your infrastructure (e.g., Kubernetes) checks this address continuously. Depending on the HTTP status code returned from a GET request to this address the service will take action when it receives an "unhealthy" response.

How does HC work

Import the module passing a key name and a target and the HttpModule from @nestjs/axios

@Module({
  imports: [HealthCheckModule.forRoot('key name', 'target'), HttpModule],
})

Usage

If everything is set up correctly, you can access the healthcheck on http://localhost:3000/health.

{
  "status": "ok",
  "info": {
    "database": {
      "status": "up"
    }
  },
  "details": {
    "database": {
      "status": "up"
    }
  }
}

Package Sidebar

Install

npm i nest-js-hc

Weekly Downloads

2

Version

0.0.7

License

ISC

Unpacked Size

163 kB

Total Files

15

Last publish

Collaborators

  • gilmarsilva