Skip to content
Snippets Groups Projects
app.controller.ts 373 B
Newer Older
  • Learn to ignore specific revisions
  • 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 {
    
      private start = Date.now();
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    
      @Get('healthcheck')
    
      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
      }
    }