Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sabinadams/nestjs-healthcheck-module
A module that adds a health-check route with a configurable service label
https://github.com/sabinadams/nestjs-healthcheck-module
Last synced: 23 days ago
JSON representation
A module that adds a health-check route with a configurable service label
- Host: GitHub
- URL: https://github.com/sabinadams/nestjs-healthcheck-module
- Owner: sabinadams
- Created: 2021-09-30T06:46:44.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-16T23:55:06.000Z (27 days ago)
- Last Synced: 2024-10-19T00:11:28.409Z (25 days ago)
- Language: TypeScript
- Size: 241 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Description
NestJS Module that adds a `/health-check` route to the module you import this into with a configurable service label.
---
## Usage
```shell
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.
```typescript
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:
```json
{
"payload": "OK",
"service": "TEST SERVICE"
}
```*If no value is passed to the register method, the `service` key will be omitted from the response*
---
## Test
```bash
# unit tests
$ npm run test# e2e tests
$ npm run test:e2e
```---
## To-Do
- Allow full configuration of response, not just a service label