aboutsummaryrefslogtreecommitdiff
path: root/web/webserver.scm
diff options
context:
space:
mode:
Diffstat (limited to 'web/webserver.scm')
-rwxr-xr-xweb/webserver.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/web/webserver.scm b/web/webserver.scm
index c8c1fb2..e1a453c 100755
--- a/web/webserver.scm
+++ b/web/webserver.scm
@@ -193,10 +193,19 @@
(string-append "Resource X not found: "
(uri->string (request-uri request)))))
+(define (view-doc path page)
+ page)
+
(define (not-found uri)
(list (build-response #:code 404)
(string-append "Resource not found: " (uri->string uri))))
+(define* (render-doc path page #:key (extra-headers '()))
+ (list (append extra-headers
+ '((content-type . (text/html))))
+ (lambda (port)
+ (display (view-doc path page) port))))
+
(define (render-json json)
(list '((content-type . (application/json)))
(lambda (port)
@@ -215,6 +224,8 @@
(render-json info))
(('GET "version")
(render-json get-version))
+ (('GET "doc" path ... page) ; serve documents from /doc/
+ (render-doc path page))
(('GET "species.json")
(render-json (get-species-rec)))
(('GET "species.meta.json")