diff options
Diffstat (limited to 'rnd')
-rw-r--r-- | rnd/apl/aoc01_partial.apl (renamed from rnd/aoc01_partial.apl) | 0 | ||||
-rw-r--r-- | rnd/gerbil/play.ss (renamed from rnd/play.ss) | 0 | ||||
-rw-r--r-- | rnd/guile/play.scm | 24 | ||||
-rw-r--r-- | rnd/racket/sketch.rkt (renamed from rnd/sketch.rkt) | 0 |
4 files changed, 24 insertions, 0 deletions
diff --git a/rnd/aoc01_partial.apl b/rnd/apl/aoc01_partial.apl index 67d9984..67d9984 100644 --- a/rnd/aoc01_partial.apl +++ b/rnd/apl/aoc01_partial.apl diff --git a/rnd/play.ss b/rnd/gerbil/play.ss index 7a7c3ca..7a7c3ca 100644 --- a/rnd/play.ss +++ b/rnd/gerbil/play.ss 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) diff --git a/rnd/sketch.rkt b/rnd/racket/sketch.rkt index dd25774..dd25774 100644 --- a/rnd/sketch.rkt +++ b/rnd/racket/sketch.rkt |