diff options
-rwxr-xr-x | web/webserver.scm | 11 |
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") |