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

0.0.4 • Public • Published

Description

NestJS Module that adds a /health-check route to the module you import this into with a configurable service label.


Usage

npm install nest-healthcheck

This dynamic module has a static method register() that allows you to optionally provide a service label as a parameter to include in the response of the health-check.

Here is a simple example based off of the starter NestJS application.

import { HealthCheckModule } from 'nest-healthcheck';

import { AppService } from './app.service';

@Module({
  imports: [HealthCheckModule.register('TEST SERVICE')],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

The application will now have a route /health-check that will return the following response:

{
  "payload": "OK",
  "service": "TEST SERVICE"
}

If no value is passed to the register method, the service key will be omitted from the response


Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

To-Do

  • Allow full configuration of response, not just a service label

Readme

Keywords

none

Package Sidebar

Install

npm i nest-healthcheck

Weekly Downloads

16

Version

0.0.4

License

UNLICENSED

Unpacked Size

91.9 kB

Total Files

27

Last publish

Collaborators

  • sabinadams