2
0
forked from jmug/cactoide

fix: small adjusments, renames for the /healthz and readme

This commit is contained in:
Levente Orban
2025-09-01 10:43:02 +02:00
parent 94fffc5695
commit 8a76421571
11 changed files with 46 additions and 40 deletions

View File

@@ -1,15 +1,15 @@
// src/routes/healthz/+server.ts
import { json } from '@sveltejs/kit';
import { drizzleQuery } from '$lib/database/db';
import { database } from '$lib/database/db';
import { sql } from 'drizzle-orm';
export async function GET() {
try {
await drizzleQuery.execute(sql`select 1`);
await database.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' },
{ ok: false, error: (err as Error)?.message, message: 'Database unreachable.' },
{ status: 503, headers: { 'cache-control': 'no-store' } }
);
}