Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nestjs/terminus
Terminus module for Nest framework (node.js) :robot:
https://github.com/nestjs/terminus
javascript nest nestjs node nodejs typescript
Last synced: 2 days ago
JSON representation
Terminus module for Nest framework (node.js) :robot:
- Host: GitHub
- URL: https://github.com/nestjs/terminus
- Owner: nestjs
- License: mit
- Created: 2018-08-24T08:43:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-28T23:31:00.000Z (about 1 month ago)
- Last Synced: 2024-10-29T14:58:34.461Z (about 1 month ago)
- Topics: javascript, nest, nestjs, node, nodejs, typescript
- Language: TypeScript
- Homepage: https://nestjs.com/
- Size: 56.5 MB
- Stars: 676
- Watchers: 8
- Forks: 100
- Open Issues: 34
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-nestjs - `@nestjs/terminus` - Integrated healthchecks, based on [Terminus](https://github.com/godaddy/terminus) package. (Components & Libraries)
- awesome-nestjs - Nest Terminus - 综合健康检查, 基于 [Terminus](https://github.com/godaddy/terminus) . (资源 / 组件和库)
README
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](https://github.com/nestjs/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!```bash
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.```typescript
// app.module.ts@Module({
controllers: [HealthController],
imports:[
// Make sure TypeOrmModule is available in the module context
TypeOrmModule.forRoot({ ... }),
TerminusModule
],
})
export class HealthModule { }```
3. Setup your `HealthController` which executes your Health Check.
```typescript
// 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`.
```json
{
"status": "ok",
"info": {
"database": {
"status": "up"
}
},
"details": {
"database": {
"status": "up"
}
}
}
```For more information, [see docs](https://docs.nestjs.com/recipes/terminus).
You can find more samples in the [samples/](https://github.com/nestjs/terminus/tree/master/sample) folder of this repository.## Contribute
In order to get started, first read through our [Contributing guidelines](https://github.com/nestjs/terminus/blob/master/CONTRIBUTING.md).
### Setup
Setup the development environment by following these instructions:
1. Fork & Clone the repository
2. Install the dependencies```bash
npm install# To rebuild the project, run
npm run build
```### Test
For unit testing run the following command:
```bash
npm run test
```For e2e testing, make sure you have docker installed
```bash
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](https://docs.nestjs.com/support).
## Stay in touch
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) and [Livio Brunner](https://brunnerliv.io)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)## License
Nest is [MIT licensed](LICENSE).