diff options
author | elioat <elioat@tilde.institute> | 2022-12-04 15:16:52 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2022-12-04 15:16:52 -0500 |
commit | 5831542e01209729390f5171d54f505b133ab47e (patch) | |
tree | 188391d6e89393849d5b6f53cfb5ca6d994536f5 /rnd/guile/play.scm | |
parent | 8f83e6377a7a5e4209f8996c1c9e6870f8ec66b5 (diff) | |
download | december-2022-5831542e01209729390f5171d54f505b133ab47e.tar.gz |
re-org of rnd
Diffstat (limited to 'rnd/guile/play.scm')
-rw-r--r-- | rnd/guile/play.scm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/rnd/guile/play.scm b/rnd/guile/play.scm new file mode 100644 index 0000000..92d5538 --- /dev/null +++ b/rnd/guile/play.scm @@ -0,0 +1,24 @@ +;;; Hello HTTP server +(use-modules + (web server) + (web request) + (web response) + (web uri)) + +(define (request-path-components request) + (split-and-decode-uri-path (uri-path (request-uri request)))) + +(define (hello-handler request body) + (if (equal? (request-path-components request) + '("banana")) + (values '((content-type . (text/plain))) + "banana kiwi apple pineapple watermelon grapefruit") + (not-found request))) + +(define (not-found request) + (values (build-response #:code 404) + (string-append "Resource not found: " + (uri->string (request-uri request))))) + + +(run-server hello-handler) |