mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-09 04:02:40 -05:00
Add Health Check Path
This commit is contained in:
parent
5c7eca32e5
commit
f1cd12fceb
17
app/routes/healthz.ts
Normal file
17
app/routes/healthz.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { LoaderFunction } from "remix";
|
||||
import { db } from "~/utils/db.server";
|
||||
|
||||
export const loader: LoaderFunction = async () => {
|
||||
try {
|
||||
const res = await db.$queryRaw`SELECT 1+1 as val;`;
|
||||
const val = (res as { val: 2 }[])[0].val;
|
||||
if (val !== 2) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
throw new Error(`val was: ${val}`);
|
||||
}
|
||||
return new Response(null, { status: 204 });
|
||||
} catch (e) {
|
||||
console.error((e as Error).message);
|
||||
return new Response(null, { status: 500 });
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user