Add ElysiaJS integration and update homepage
This commit is contained in:
parent
3197d2fb1b
commit
666b2d0e0d
12 changed files with 112 additions and 100 deletions
10
server/modules/health/index.ts
Normal file
10
server/modules/health/index.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { Elysia } from "elysia";
|
||||
|
||||
import { HealthModel } from "./model";
|
||||
import { Health } from "./service";
|
||||
|
||||
export const health = new Elysia({ prefix: "/health" }).get(
|
||||
"/",
|
||||
() => Health.check(),
|
||||
{ response: HealthModel.checkResponse },
|
||||
);
|
||||
11
server/modules/health/model.ts
Normal file
11
server/modules/health/model.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { t, type UnwrapSchema } from "elysia";
|
||||
|
||||
export const HealthModel = {
|
||||
checkResponse: t.Object({
|
||||
status: t.Literal("ok"),
|
||||
}),
|
||||
} as const;
|
||||
|
||||
export type HealthModel = {
|
||||
[k in keyof typeof HealthModel]: UnwrapSchema<(typeof HealthModel)[k]>;
|
||||
};
|
||||
9
server/modules/health/service.ts
Normal file
9
server/modules/health/service.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { HealthModel } from "./model";
|
||||
|
||||
export abstract class Health {
|
||||
static async check() {
|
||||
return {
|
||||
status: "ok",
|
||||
} satisfies HealthModel["checkResponse"];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue