forked from jmug/cactoide
add healthz, docker fixes, minor readme tweaks
This commit is contained in:
committed by
Levente Orban
parent
cc8266ae6e
commit
94fffc5695
16
src/routes/healthz/+server.ts
Normal file
16
src/routes/healthz/+server.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
// src/routes/healthz/+server.ts
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { drizzleQuery } from '$lib/database/db';
|
||||
import { sql } from 'drizzle-orm';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
await drizzleQuery.execute(sql`select 1`);
|
||||
return json({ ok: true }, { headers: { 'cache-control': 'no-store' } });
|
||||
} catch (err) {
|
||||
return json(
|
||||
{ ok: false, error: (err as Error)?.message ?? 'DB unavailable' },
|
||||
{ status: 503, headers: { 'cache-control': 'no-store' } }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user