src/health/health.controller.ts
health
Methods |
|
| Async check |
check()
|
Decorators :
@Get()
|
|
Defined in src/health/health.controller.ts:12
|
|
Returns :
unknown
|
import { Controller, Get, HttpStatus, HttpCode } from '@nestjs/common';
import { SkipThrottle } from '@nestjs/throttler';
import { PrismaService } from '../prisma/prisma.service';
@SkipThrottle()
@Controller('health')
export class HealthController {
constructor(private prisma: PrismaService) {}
@Get()
@HttpCode(HttpStatus.OK)
async check() {
try {
await this.prisma.$queryRaw`SELECT 1`;
return { status: 'ok' };
} catch {
return { status: 'error' };
}
}
}