File

src/health/health.controller.ts

Prefix

health

Index

Methods

Methods

Async check
check()
Decorators :
@Get()
@HttpCode(HttpStatus.OK)
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' };
    }
  }
}

results matching ""

    No results matching ""