Replies: 1 comment
-
This proposal is already usable, but I look forward to suggestions on how we can improve it.How to use the Redis indicator for the Terminus library?"//health.module.ts
import { Module } from '@nestjs/common';
import { TerminusModule } from '@nestjs/terminus';
import { RedisHealthModule, } from '@nestjs-modules/ioredis';
@Module({
imports: [TerminusModule, RedisHealthModule],
controllers: [HealthController]
})
export class HealthModule {} //health.controller.ts
import { Controller, Get } from '@nestjs/common';
import {
HealthCheckService,
HealthCheck,
HealthCheckResult
} from '@nestjs/terminus';
import { RedisHealthIndicator } from './redis.health';
@Controller('health')
export class HealthController {
constructor(
private health: HealthCheckService,
private redis: RedisHealthIndicator,
) {}
@Get()
@HealthCheck()
check(): Promise<HealthCheckResult> {
return this.health.check([
async () => this.redis.isHealthy('redis'),
]);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
nestjs/terminus#1288 (comment)
Beta Was this translation helpful? Give feedback.
All reactions