Created
August 12, 2020 18:45
-
-
Save kop7/75dde75b1e326ae7a625001705267870 to your computer and use it in GitHub Desktop.
App Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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