-
Notifications
You must be signed in to change notification settings - Fork 0
/
health.controller.ts
32 lines (26 loc) · 1009 Bytes
/
health.controller.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Controller, Get, Res } from "@nestjs/common";
import { Response } from "express";
import { SettingsDataGateway } from "src/infra/data/gateways/settings.gateway";
@Controller("health")
export class HealthController {
constructor(private _repository: SettingsDataGateway) {
}
@Get("readiness")
async readiness(@Res() response: Response) {
const readiness = await this._repository.getReadinessSettingsAsync();
console.log("READINESS: ", readiness);
if (readiness)
response.status(200).json({ status: "success" });
else
response.status(400).json({ status: "failed" })
}
@Get("liveness")
async liveness(@Res() response: Response) {
const liveness = await this._repository.getLivessSettingsAsync();
console.log("LIVENESS: ", liveness);
if (liveness)
response.status(200).json({ status: "success" });
else
response.status(400).json({ status: "failed" })
}
}