import { Controller, Get } from '@nestjs/common'; import { HealthCheck, HealthCheckService } from '@nestjs/terminus'; import { PostgresHealthIndicator } from './postgres.health'; import { RedisHealthIndicator } from './redis.health'; @Controller('health') export class HealthController { constructor( private health: HealthCheckService, private postgres: PostgresHealthIndicator, private redis: RedisHealthIndicator, ) {} @Get() @HealthCheck() async check() { return this.health.check([ () => this.postgres.pingCheck('database'), () => this.redis.pingCheck('redis'), ]); } }