From ef89b655e942603605d0d94837ba2407f86352bf Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 8 Jun 2025 01:37:48 +0200 Subject: Implement Tree and Blob views. Getting real close to something good now! --- lib/handlers.ml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/handlers.ml') diff --git a/lib/handlers.ml b/lib/handlers.ml index 17f3ac0..21d3ea8 100644 --- a/lib/handlers.ml +++ b/lib/handlers.ml @@ -31,16 +31,19 @@ module Repo = struct Views.Repo.log (repo req) commits |> Dream_html.respond let tree_head req = - Dream.log "Tree head"; let* tree = head_tree (repo req) in Views.Repo.tree (repo req) tree |> Dream_html.respond let tree_id req = - Dream.log "Tree id"; let id = id_of_req req in let* tree = tree_of_id (repo req) id in Views.Repo.tree (repo req) tree |> Dream_html.respond + let blob_id req = + let id = id_of_req req in + let* blob = blob_of_id (repo req) id in + Views.Repo.blob (repo req) blob |> Dream_html.respond + let commit req = let id = id_of_req req in let* commit = commit_of_id (repo req) id in @@ -59,6 +62,7 @@ let all_handlers = get "/log/" log; get "/tree/" tree_head; get "/tree/:id" tree_id; + get "/blob/:id" blob_id; get "/commit/:id" commit; ]; get "/static/**" (static "./lib/static"); -- cgit v1.2.3