aboutsummaryrefslogtreecommitdiff
path: root/gn3-guile/web/webserver.scm
diff options
context:
space:
mode:
authorPjotr Prins2023-07-06 01:45:49 -0500
committerPjotr Prins2023-07-06 01:45:49 -0500
commit8332a0c3b4d736a600699cf1668ef486082ebc88 (patch)
tree5235248f1cf97e9bafa418ff395077115405e368 /gn3-guile/web/webserver.scm
parent6fb93ceeeea228e638f11ffa770d58c730268c69 (diff)
downloadgenenetwork3-8332a0c3b4d736a600699cf1668ef486082ebc88.tar.gz
guile: propose adding end points to output
Diffstat (limited to 'gn3-guile/web/webserver.scm')
-rwxr-xr-xgn3-guile/web/webserver.scm35
1 files changed, 20 insertions, 15 deletions
diff --git a/gn3-guile/web/webserver.scm b/gn3-guile/web/webserver.scm
index f5fedd7..7809661 100755
--- a/gn3-guile/web/webserver.scm
+++ b/gn3-guile/web/webserver.scm
@@ -14,27 +14,32 @@
(web uri))
(define (get-version-str)
- "\"1.0\"")
+ "2.0")
-(define info-list (scm->json-string '(
- ("name"."GeneNetwork REST API")
- ("version"."1.0")
- ("note"."work in progress (WIP)")
- )))
+(define info-list (scm->json-string `(
+ ("name" . "GeneNetwork REST API")
+ ("version" . ,(get-version-str))
+ ("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/"
+ )
+ ))))
(define (get-gn-info-str)
info-list
)
(define (get-species-str)
- "{
-\"Mus_musculus\": {
- \"id\": \"mouse\"
- },
-\"Rattus_norvegicus\": {
- \"id\": \"rat\"
- }
-}")
+ (scm->json-string '(("Mus_musculus" . (("id" . "mouse" )
+ ("api" . "https://genenetwork.org/api/v2/mouse/")))
+ ("Rattus_norvegicus" . (("id" . "rat")
+ ("api" . "https://genenetwork.org/api/v2/rat/")))
+ )))
+
;; ---- REST API web server handler
@@ -62,7 +67,7 @@
(uri->string (request-uri request)))))
(define (main args)
- (write "Starting Guile REST API server!")
+ (write (string-append "Starting Guile REST API " (get-version-str) " server!"))
(write args)
(newline)
(let ((listen (inexact->exact (string->number (car (cdr args))))))