* chore: installed terminus package and scaffolded the health module * feat: added healthcheck for database with prisma * chore: renamed label from prisma to database in health check route * chore: reverted target of hopp-old-backend service to prod
25 lines
564 B
TypeScript
25 lines
564 B
TypeScript
import { Controller, Get } from '@nestjs/common';
|
|
import {
|
|
HealthCheck,
|
|
HealthCheckService,
|
|
PrismaHealthIndicator,
|
|
} from '@nestjs/terminus';
|
|
import { PrismaService } from 'src/prisma/prisma.service';
|
|
|
|
@Controller('health')
|
|
export class HealthController {
|
|
constructor(
|
|
private health: HealthCheckService,
|
|
private prismaHealth: PrismaHealthIndicator,
|
|
private prisma: PrismaService,
|
|
) {}
|
|
|
|
@Get()
|
|
@HealthCheck()
|
|
check() {
|
|
return this.health.check([
|
|
async () => this.prismaHealth.pingCheck('database', this.prisma),
|
|
]);
|
|
}
|
|
}
|