mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-18 02:31:56 +10:00
feat(health): add health checks to server api
This commit is contained in:
21
server/src/health/health.controller.ts
Normal file
21
server/src/health/health.controller.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
import { HealthCheck, HealthCheckService, HttpHealthIndicator, TypeOrmHealthIndicator } from '@nestjs/terminus';
|
||||
|
||||
@Controller('health')
|
||||
export class HealthController {
|
||||
constructor(
|
||||
private health: HealthCheckService,
|
||||
private db: TypeOrmHealthIndicator,
|
||||
private http: HttpHealthIndicator
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
@HealthCheck()
|
||||
check() {
|
||||
return this.health.check([
|
||||
() => this.db.pingCheck('database'),
|
||||
() => this.http.pingCheck('app', 'https://rxresu.me'),
|
||||
() => this.http.pingCheck('docs', 'https://beta.rxresu.me'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user