api home also shows docs

This commit is contained in:
2026-05-27 23:16:48 +02:00
parent f69d7be71d
commit 761ae95175
+6 -4
View File
@@ -3,14 +3,16 @@ let () =
@@ Dream.logger @@ Dream.logger
@@ Dream.router @@ Dream.router
[ [
(* 1. Health check (Exact match) *) Dream.get "/" (fun request ->
Dream.from_filesystem "static" "doc.html" request);
(* Health check (Exact match) *)
Dream.get "/health" (fun _ -> Dream.respond "OK"); Dream.get "/health" (fun _ -> Dream.respond "OK");
(* 2. Specific API Endpoints (Must be ABOVE the wildcard) *) (* Specific API Endpoints (Must be ABOVE the wildcard) *)
Dream.get "/api/v1/pdf" (fun _ -> Dream.html "Generate PDF"); Dream.get "/api/v1/pdf" (fun _ -> Dream.html "Generate PDF");
(* 3. Exact match for the docs root *) (* Exact match for the docs root *)
Dream.get "/api/v1" (fun request -> Dream.get "/api/v1" (fun request ->
Dream.from_filesystem "static" "doc.html" request); Dream.from_filesystem "static" "doc.html" request);
(* 4. Dedicated route for swagger.json if accessed outside /api/ *) (* Dedicated route for swagger.json if accessed outside /api/ *)
Dream.get "/swagger.json" (fun request -> Dream.get "/swagger.json" (fun request ->
Dream.from_filesystem "static" "swagger.json" request); Dream.from_filesystem "static" "swagger.json" request);
] ]