Skip to content
Snippets Groups Projects
app.controller.ts 359 B
Newer Older
Hugo SUBTIL's avatar
Hugo SUBTIL committed
import { Controller, Get } from '@nestjs/common';
@Controller()
export class AppController {
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  private start: number;
Hugo SUBTIL's avatar
Hugo SUBTIL committed

Hugo SUBTIL's avatar
Hugo SUBTIL committed
  constructor() {
    this.start = Date.now();
  }

  @Get('healthcheck')
  async healthcheck() {
    const now = Date.now();
    return {
      status: 'API Online',
      uptime: Number((now - this.start) / 1000).toFixed(0),
    };
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  }
}