From 88c3cd78630ffa00737138398f9dd2e951925876 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 8 Jul 2023 05:45:49 -0500 Subject: guile server: try meta example --- gn3-guile/web/webserver.scm | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'gn3-guile/web') 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") -- cgit v1.2.3