-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f2c16a
commit 6ab0dca
Showing
6 changed files
with
190 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,35 @@ | ||
import { Controller, Get } from "@nestjs/common"; | ||
import { | ||
HealthCheckService, | ||
HttpHealthIndicator, | ||
HealthCheck, | ||
TypeOrmHealthIndicator, | ||
HealthCheckResult, | ||
} from "@nestjs/terminus"; | ||
import { MetaService } from "./meta.service"; | ||
import { type MetaInfo } from "@graduate/common"; | ||
|
||
@Controller("meta") | ||
export class MetaController { | ||
constructor(private readonly metaService: MetaService) {} | ||
constructor( | ||
private readonly metaService: MetaService, | ||
private health: HealthCheckService, | ||
private http: HttpHealthIndicator, | ||
private db: TypeOrmHealthIndicator | ||
) {} | ||
|
||
@Get("/info") | ||
getMetaInfo(): MetaInfo { | ||
return this.metaService.getMetaInfo(); | ||
} | ||
|
||
@Get("/health") | ||
@HealthCheck() | ||
async getHealthInfo(): Promise<HealthCheckResult> { | ||
return await this.metaService.getHealthInfo( | ||
this.health, | ||
this.http, | ||
this.db | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { Module } from "@nestjs/common"; | ||
import { TerminusModule } from "@nestjs/terminus"; | ||
import { HttpModule } from "@nestjs/axios"; | ||
import { MetaService } from "./meta.service"; | ||
import { MetaController } from "./meta.controller"; | ||
|
||
@Module({ | ||
controllers: [MetaController], | ||
providers: [MetaService], | ||
imports: [HttpModule, TerminusModule], | ||
exports: [MetaService], | ||
}) | ||
export class MetaModule {} |
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
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
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