mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-02 13:22:11 +03:00
* fix: add native health endpoint * fix: keep health endpoint dynamic --------- Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com>
24 lines
645 B
TypeScript
24 lines
645 B
TypeScript
export type ServerLifecyclePhase = "starting" | "ready" | "stopping";
|
|
|
|
declare global {
|
|
var __omnirouteServerLifecycle: ServerLifecyclePhase | undefined;
|
|
}
|
|
|
|
export function getServerLifecyclePhase(): ServerLifecyclePhase {
|
|
return globalThis.__omnirouteServerLifecycle ?? "starting";
|
|
}
|
|
|
|
export function markServerStarting(): void {
|
|
globalThis.__omnirouteServerLifecycle = "starting";
|
|
}
|
|
|
|
export function markServerReady(): void {
|
|
if (getServerLifecyclePhase() !== "stopping") {
|
|
globalThis.__omnirouteServerLifecycle = "ready";
|
|
}
|
|
}
|
|
|
|
export function markServerStopping(): void {
|
|
globalThis.__omnirouteServerLifecycle = "stopping";
|
|
}
|