(use spiffy simple-directory-handler spiffy-uri-match intarweb uri-common sxml-serializer) (define (send-sxml-response sxml) (with-headers `((connection close)) (lambda () (write-logged-response))) (serialize-sxml sxml output: (response-port (current-response)))) (define my-custom-routes `(((/ "greeting") (GET ,(lambda _ (let* ((q (uri-query (request-uri (current-request)))) (name (alist-ref 'name q)) (greeting (if (and name (not (string=? name ""))) (sprintf "Hi there, ~A!" name) "Please type in your name below"))) (send-sxml-response `(html (head (title ,greeting)) (body (h1 ,greeting) (form (input (@ (type "text") (name "name"))) (input (@ (type "submit") (value "Go!")))) (p "If you're bored, you can " (a (@ (href "/")) "go back to browsing the docroot"))))))))))) (vhost-map ; Make route matching available on all virtual hosts `((".*" . ,(uri-match/spiffy my-custom-routes)))) ;; Let simple-directory-handler handle directories (default is 304 access denied) (handle-directory simple-directory-handler) (start-server)