aboutsummaryrefslogtreecommitdiff
path: root/web/webserver.scm
diff options
context:
space:
mode:
authorPjotr Prins2023-08-10 14:12:07 +0200
committerPjotr Prins2023-08-10 14:12:07 +0200
commit3d54c221d0c70c1bf727148642546130cb15a19a (patch)
tree9613c6a0787f5dab70536a6f660306d74c3d747d /web/webserver.scm
parent7851b6408e4954e7b2ebce500de8734b246ee439 (diff)
downloadgn-guile-3d54c221d0c70c1bf727148642546130cb15a19a.tar.gz
Getting taxon metadata
Diffstat (limited to 'web/webserver.scm')
-rwxr-xr-xweb/webserver.scm16
1 files changed, 12 insertions, 4 deletions
diff --git a/web/webserver.scm b/web/webserver.scm
index 537fad5..bb6412d 100755
--- a/web/webserver.scm
+++ b/web/webserver.scm
@@ -135,10 +135,14 @@
(string-replace-substring str " " "_")
)
-(define (get-expanded-taxon id)
+(define (get-expanded-taxon-meta id)
"Get information on a specific species, e.g. mouse"
- #f
- )
+ `(("info" . ,id)
+ ("doc" . ,(mk-doc id))
+ ("meta" . ,(mk-meta id))
+ ("data" . ,(mk-rec id))
+ ("up" . ,(mk-meta "species"))
+ ))
(define (get-expanded-species)
"Here we add information related to each species"
@@ -240,6 +244,10 @@
(render-json get-version))
(('GET "doc" "species.html")
(render-doc "doc" "species.html" (get-species-meta)))
+ (('GET "doc" taxon)
+ (match (string->list taxon)
+ [(name ... #\. #\h #\t #\m #\l)
+ (render-doc "doc" taxon (get-expanded-taxon-meta (list->string name)))]))
(('GET "doc" path ... page) ; serve documents from /doc/
(render-doc path page))
(('GET "species.json")
@@ -251,7 +259,7 @@
(('GET id)
(let ([names (get-species-shortnames (get-expanded-species))])
(match (string->list id)
- [(name ... #\. #\j #\s #\o #\n) (render-json (list->string name))]
+ [(name ... #\. #\m #\e #\t #\a #\. #\j #\s #\o #\n) (render-json (get-expanded-taxon-meta (list->string name)))]
[rest (render-json "WIP")])))
(_ (not-found (request-uri request)))
))