(type egg)
(signature "spiffy-uri-match egg")
(timestamp 1612269487)
(sxml ((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/spiffy-uri-match" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg")) (section 2 "spiffy-uri-match" (toc) (section 3 "Description" (p "A library providing integration of " (int-link "uri-match") " for " (int-link "spiffy") ".")) (section 3 "Author" (p "Moritz Heidkamp")) (section 3 "Requirements" (p "Requires the " (int-link "uri-match") ", " (int-link "spiffy") ", " (int-link "uri-common") " and " (int-link "intarweb") " extensions.")) (section 3 "Documentation" (def (sig (procedure "(uri-match/spiffy routes)" (id uri-match/spiffy))) (p "Returns a procedure suitable for use as a spiffy handler. It will match against the HTTP method and URI of the " (tt "current-request") " parameter. The " (tt "routes") " argument is passed directly to " (tt "make-uri-matcher") " of " (int-link "uri-match") " and thus must be in the format described there. If a route matches, its handler is called with " (tt "current-response") " modified to include the headers given in the " (tt "default-response-headers") " parameter. If no route matches, the handler will call the " (tt "continue") " procedure passed by spiffy.") (p (int-link "uri-match/spiffy") " integrates with spiffy via the vhost-map hooks.") (highlight scheme "(vhost-map `((\".*\" . ,(lambda (continue) (continue)))))\n(vhost-map `((\".*\" . ,(lambda (c) (send-status 200 \"TEST\")))))\n(vhost-map `((\".*\" . ,(uri-match/spiffy\n\t\t\t`(((/ \"\")\n\t\t\t   (GET ,(lambda (c) (c)))))))))\n(vhost-map `((\".*\" . ,(uri-match/spiffy\n\t\t\t`(((/ \"\")\n\t\t\t   (GET ,(lambda (c) (send-status 200 \"TEST\")))))))))\n(vhost-map `((\".*\" . ,(uri-match/spiffy\n\t\t\t`(((/ \"\")\n\t\t\t   (GET ,(lambda (c)\n\t\t\t\t   (send-response\n\t\t\t\t     status: 'ok\n\t\t\t\t     body: \"Hello World!\"\n\t\t\t\t     headers: '((content-type text/html)))))))))))")) (def (sig (parameter "(default-response-headers [headers])" (id default-response-headers))) (p "A list of headers to be used for all requests handled by handlers created through " (tt "uri-match/spiffy") ". Defaults to") (pre " '((content-type #(text/html ((charset . \"utf-8\"))))\n   (accept-charset utf-8))")) (def (sig (procedure "(redirect-to path #!key (code 302) (headers '()))" (id redirect-to))) (p "Convenience procedure for sending redirects relative to the current " (tt "server-root-uri") "."))))))
