Files
pocket-id/frontend/src/routes/healthz/+server.ts
2025-05-06 22:14:18 +02:00

19 lines
446 B
TypeScript

import type { RequestHandler } from '@sveltejs/kit';
import axios from 'axios';
export const GET: RequestHandler = async () => {
const backendOK = await axios
.get(process!.env!.INTERNAL_BACKEND_URL + '/healthz')
.then(() => true, () => false);
return new Response(
backendOK ? `{"status":"HEALTHY"}` : `{"status":"UNHEALTHY"}`,
{
status: backendOK ? 200 : 500,
headers: {
'content-type': 'application/json'
}
}
);
};