Skip to content

Instantly share code, notes, and snippets.

@kop7
Created August 12, 2020 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kop7/75dde75b1e326ae7a625001705267870 to your computer and use it in GitHub Desktop.
Save kop7/75dde75b1e326ae7a625001705267870 to your computer and use it in GitHub Desktop.
App Controller
import { Controller, Get } from '@nestjs/common';
@Controller()
export class AppController {
private start: number;
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),
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment