aboutsummaryrefslogtreecommitdiff
path: root/gn3-guile/web/webserver.scm
diff options
context:
space:
mode:
authorPjotr Prins2023-07-08 05:45:49 -0500
committerPjotr Prins2023-07-08 05:45:49 -0500
commit88c3cd78630ffa00737138398f9dd2e951925876 (patch)
tree681b74afbe1114a314d2c21b77e47e56a68c3b4a /gn3-guile/web/webserver.scm
parentb70fdef2f3edce38324fff04052a3ec8054ffa1f (diff)
downloadgenenetwork3-88c3cd78630ffa00737138398f9dd2e951925876.tar.gz
guile server: try meta example
Diffstat (limited to 'gn3-guile/web/webserver.scm')
-rwxr-xr-xgn3-guile/web/webserver.scm30
1 files changed, 22 insertions, 8 deletions
diff --git a/gn3-guile/web/webserver.scm b/gn3-guile/web/webserver.scm
index f940a08..cbb1be1 100755
--- a/gn3-guile/web/webserver.scm
+++ b/gn3-guile/web/webserver.scm
@@ -21,18 +21,30 @@
(define (get-version)
"2.0")
-(define info-list `(
+(define (base-url)
+ "https://genenetwork.org")
+
+(define (prefix)
+ (string-append (base-url) "/api/" (get-version)))
+
+(define (mk-url postfix)
+ (string-append (prefix) "/" postfix))
+
+(define (meta url)
+ (string-append url "/meta"))
+
+(define info `(
("name" . "GeneNetwork REST API")
("version" . ,(get-version))
("comment" . "This is the official REST API for the GeneNetwork service hosted at https://genenetwork.org/")
("license" . (("source code" . "AGPL")))
("note" . "work in progress (WIP)")
- ("api". #(
- "https://genenetwork.org/api/v2/species/"
- "https://genenetwork.org/api/v2/populations/"
- "https://genenetwork.org/api/v2/datasets/"
- )
- )))
+ ("see also". ,(meta (prefix)))
+ ))
+
+(define info-meta `(
+ ("API" .
+ (((mk-url "species")."Get a list of all species")))))
(define (get-species)
'(("Mus_musculus" . (("id" . "mouse" )
@@ -60,7 +72,9 @@
(define (controller request body)
(match-lambda
(('GET)
- (render-json info-list))
+ (render-json info))
+ (('GET "meta")
+ (render-json info-meta))
(('GET "version")
(render-json (get-version)))
(('GET "species")