;;; 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 (routes-handler request body) (cond ((equal? (request-path-components request) '("banana")) (values '((content-type . (text/plain))) "banana kiwi apple pineapple watermelon grapefruit")) ((equal? (request-path-components request) '("corn")) (values '((content-type . (text/plain))) "corn oats millit wheat amaranth quinoa")) (not-found request))) (define (not-found request) (values (build-response #:code 404) (string-append "Resource not found: " (uri->string (request-uri request))))) (run-server routes-handler)