nestjs/terminus
关于
适用于 Nest 框架(Node.js)的 Terminus 模块 :robot:
开发工具实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- +1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
Description
This module contains integrated healthchecks for Nest.
Installation
@nestjs/terminus integrates with a lot of technologies, such as typeorm, grpc, mongodb, and many more!
npm install --save @nestjs/terminus
Usage
- Import the Terminus module
- 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 { }
- Setup your
HealthControllerwhich 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').withTimeout(1000),
]);
}
}
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:
- Fork & Clone the repository
- Install the dependencies
pnpm i
pnpm dev
In order to test the library against a sample, go to a sample, build it and start it:
cd sample/000-kitchen-sink-app
pnpm build
pnpm start
[!NOTE] Once the library is rebuilt, the sample needs to be rebuilt and restarted in order to pick up the changes.
Test
For unit testing run the following command:
pnpm test
For e2e testing, a Docker Compose stack is required. Make sure Docker is installed on your machine and run the following command.
docker compose up -d
pnpm 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
- Author - Kamil Myśliwiec and Livio Brunner
- Website - https://nestjs.com
- Twitter - @nestframework
License
Nest is MIT licensed.
探索相关项目
加载中…