Add a JSON representation for repositories
This commit is contained in:
parent
02681d7e7a
commit
f7933807ac
1 changed files with 17 additions and 3 deletions
|
|
@ -44,9 +44,23 @@
|
||||||
(match method-and-path-components
|
(match method-and-path-components
|
||||||
(('GET "repositories")
|
(('GET "repositories")
|
||||||
(let ((git-repositories (all-git-repositories conn)))
|
(let ((git-repositories (all-git-repositories conn)))
|
||||||
|
(case (most-appropriate-mime-type
|
||||||
|
'(application/json text/html)
|
||||||
|
mime-types)
|
||||||
|
((application/json)
|
||||||
|
(render-json
|
||||||
|
`((repositories
|
||||||
|
. ,(list->vector
|
||||||
|
(map (match-lambda
|
||||||
|
((id label url cgit-base-url)
|
||||||
|
`((id . ,id)
|
||||||
|
(label . ,label)
|
||||||
|
(url . ,url))))
|
||||||
|
git-repositories))))))
|
||||||
|
(else
|
||||||
(render-html
|
(render-html
|
||||||
#:sxml
|
#:sxml
|
||||||
(view-git-repositories git-repositories))))
|
(view-git-repositories git-repositories))))))
|
||||||
(('GET "repository" id)
|
(('GET "repository" id)
|
||||||
(match (select-git-repository conn id)
|
(match (select-git-repository conn id)
|
||||||
((label url cgit-url-base)
|
((label url cgit-url-base)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue