add swagger docs to api

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