72d94170b4
Haskell backend: Orb HTTP framework, JSON-only API Frontend: Mithril.js SPA with TypeScript, Neo Brutalism CSS Dockerized build via flipstone/haskell-tools image Routes: GET /api/health — health check Build: ./hs stack build Test: ./hs stack test Run: ./scripts/run
22 lines
466 B
TypeScript
22 lines
466 B
TypeScript
/**
|
|
* Thin API client for the Sis backend.
|
|
*/
|
|
|
|
const BASE = "/api";
|
|
|
|
async function request<T>(path: string): Promise<T> {
|
|
const resp = await fetch(BASE + path);
|
|
if (!resp.ok) {
|
|
throw new Error(`HTTP ${resp.status}: ${resp.statusText}`);
|
|
}
|
|
return resp.json() as Promise<T>;
|
|
}
|
|
|
|
export interface HealthResponse {
|
|
message: string;
|
|
}
|
|
|
|
export function checkHealth(): Promise<string> {
|
|
return request<HealthResponse>("/health").then((r) => r.message);
|
|
}
|