Terminus module for Nest framework (node.js) 🤖 https://nestjs.com/
Find a file
Sophia Hage a46d329d39
fix: 🐛 cache open channels
Channels reference themselves with timeout's, meaning that they cannot
be garbage collected by v8. This is a workaround that stops us from
creating more and more channels; thus fixing a memory leak.
2023-09-14 08:47:41 +02:00
.github v10.0.0 (#2282) 2023-06-17 01:55:26 +02:00
.husky chore(): update husky scripts 2022-05-18 17:35:13 +02:00
e2e v10.0.0 (#2282) 2023-06-17 01:55:26 +02:00
lib fix: 🐛 cache open channels 2023-09-14 08:47:41 +02:00
sample chore(deps): bump mongodb and mongoose (#2327) 2023-09-06 17:26:20 +02:00
tools v10.0.0 (#2282) 2023-06-17 01:55:26 +02:00
.commitlintrc.json chore: add commilint 2021-01-31 19:04:04 +01:00
.eslintignore v10.0.0 (#2282) 2023-06-17 01:55:26 +02:00
.eslintrc.js chore: fix eslint configuration 2022-03-03 19:21:32 -04:00
.gitignore v10.0.0 (#2282) 2023-06-17 01:55:26 +02:00
.npmignore chore: update .npmignore 2022-11-17 13:17:28 +01:00
.nvmrc chore(deps): update dependency node to v16.20.1 (#2305) 2023-07-17 17:31:55 +02:00
.prettierignore v10.0.0 (#2282) 2023-06-17 01:55:26 +02:00
.prettierrc Initial commit 2018-08-29 16:38:28 +02:00
.release-it.json chore: add conventional changelog to release it 2021-01-31 21:16:53 +01:00
CHANGELOG.md chore(): release v10.0.1 2023-06-17 14:32:54 +02:00
CONTRIBUTING.md chore: replace gitter by discord on contributing guide 2022-05-15 18:44:26 -04:00
docker-compose.yml chore(): remove dependencies on package.json 2022-04-14 19:06:32 +02:00
Dockerfile chore(deps): update node.js to v17 2021-10-20 19:15:43 +00:00
Gulpfile.js chore(): updated gulp configurations 2021-03-27 23:25:13 +01:00
index.d.ts fix(package): typeorm package dependencies 2018-11-06 14:22:10 +01:00
index.js fix(test): Fix ts error on compilation 2018-11-07 21:58:41 +01:00
index.ts test(dns): Add more dns error tests 2018-11-07 22:40:43 +01:00
jest.json test(grpc): Add unit test for GRPCHealthIndicator 2019-06-03 18:08:00 +02:00
LICENSE docs(license): update LICENSE 2021-01-04 17:00:23 +01:00
package-lock.json chore(deps): update dependency @nestjs/swagger to v7.1.2 2023-07-20 12:08:36 +00:00
package.json chore(deps): update dependency @nestjs/swagger to v7.1.2 2023-07-20 12:08:36 +00:00
README.md docs(readme): update logo 2022-04-14 18:19:49 +02:00
renovate.json chore: Automerge devDependencies with renovate 2019-11-17 11:37:05 +01:00
tsconfig.base.json feat: add custom logger 2023-01-27 14:01:04 +01:00
tsconfig.build.json feat: add custom logger 2023-01-27 14:01:04 +01:00
tsconfig.json feat: add custom logger 2023-01-27 14:01:04 +01:00

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.

NPM Version Package License NPM Downloads Discord Backers on Open Collective Sponsors on Open Collective

Description

This module contains integrated healthchecks for Nest.

Installation

@nestjs/terminus integrates with a lot of cool technologies, such as typeorm, grpc, mongodb, and many more! In case you have missed a dependency, @nestjs/terminus will throw an error and prompt you to install the required dependency. So you will only install what is actually required!


npm install --save @nestjs/terminus

Usage

  1. Import the Terminus module
  2. Make sure the additionally needed modules are available to (e.g. TypeOrmModule), in case you want to do Database Health Checks.
// app.module.ts

@Module({
  controllers: [HealthController],
  imports:[
    // Make sure TypeOrmModule is available in the module context
    TypeOrmModule.forRoot({ ... }),
    TerminusModule
  ],
})
export class HealthModule { }

  1. Setup your HealthController which executes your Health Check.
// health.controller.ts

@Controller('health')
export class HealthController {
  constructor(
    private health: HealthCheckService,
    private db: TypeOrmHealthIndicator,
  ) {}

  @Get()
  @HealthCheck()
  readiness() {
    return this.health.check([
      async () => this.db.pingCheck('database', { timeout: 300 }),
    ]);
  }
}

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"
    }
  }
}

For more information, see docs. You can find more samples in the samples/ folder of this repository.

Contribute

In order to get started, first read through our Contributing guidelines.

Setup

Setup the development environment by following these instructions:

  1. Fork & Clone the repository
  2. Install the dependencies
npm install

# To rebuild the project, run
npm run build

Test

For unit testing run the following command:

npm run test

For e2e testing, make sure you have docker installed

docker-compose up -d
npm run test:e2e

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.