Files
sis/frontend/src/api.ts
T
jbrechtel 72d94170b4 Initial project skeleton
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
2026-07-15 14:51:27 -04:00

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);
}