apps/api/src/app/app.controller.ts
Methods |
check |
check()
|
Decorators :
@Get('health')
|
Defined in apps/api/src/app/app.controller.ts:29
|
Returns :
Promise<HealthCheckResult>
|
Async getData |
getData()
|
Decorators :
@Get()
|
Defined in apps/api/src/app/app.controller.ts:23
|
Returns :
unknown
|
import { Controller, Get } from '@nestjs/common'
import { AppService } from './app.service'
import {
HealthCheck,
HealthCheckResult,
HealthCheckService,
MemoryHealthIndicator,
TypeOrmHealthIndicator
} from '@nestjs/terminus'
@Controller()
export class AppController {
constructor(
private readonly appService: AppService,
private health: HealthCheckService,
private orm: TypeOrmHealthIndicator,
private memory: MemoryHealthIndicator
) {}
@Get()
async getData() {
return await this.appService.getData()
}
@Get('health')
@HealthCheck()
check(): Promise<HealthCheckResult> {
return this.health.check([
() => this.orm.pingCheck('db'),
() => this.memory.checkRSS('mem_rss', 768 * 2 ** 20 /* 768 MB */)
])
}
}