feat: 添加 NestJS API 基础设施
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { Controller, Get, Inject } from "@nestjs/common";
|
||||
import { HealthService } from "./health.service.js";
|
||||
|
||||
@Controller("health")
|
||||
export class HealthController {
|
||||
constructor(
|
||||
@Inject(HealthService) private readonly healthService: HealthService,
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
check(): Promise<{ status: "ok"; postgres: "up"; redis: "up" }> {
|
||||
return this.healthService.check();
|
||||
}
|
||||
|
||||
@Get("live")
|
||||
live(): { status: "ok" } {
|
||||
return { status: "ok" };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user