Skip to content
Snippets Groups Projects
app.controller.ts 373 B
Newer Older
Hugo SUBTIL's avatar
Hugo SUBTIL committed
import { Controller, Get } from '@nestjs/common';
import { version } from '../package.json';
Hugo SUBTIL's avatar
Hugo SUBTIL committed
@Controller()
export class AppController {
Bastien DUMONT's avatar
Bastien DUMONT committed
  private start = Date.now();
Hugo SUBTIL's avatar
Hugo SUBTIL committed

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