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
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
Reference in New Issue
Block a user