chickadee » spiffy-uri-match » uri-match/spiffy

uri-match/spiffy routesprocedure

Returns a procedure suitable for use as a spiffy handler. It will match against the HTTP method and URI of the current-request parameter. The routes argument is passed directly to make-uri-matcher of uri-match and thus must be in the format described there. If a route matches, its handler is called with current-response modified to include the headers given in the default-response-headers parameter. If no route matches, the handler will call the continue procedure passed by spiffy.

uri-match/spiffy integrates with spiffy via the vhost-map hooks.

(vhost-map `((".*" . ,(lambda (continue) (continue)))))
(vhost-map `((".*" . ,(lambda (c) (send-status 200 "TEST")))))
(vhost-map `((".*" . ,(uri-match/spiffy
			`(((/ "")
			   (GET ,(lambda (c) (c)))))))))
(vhost-map `((".*" . ,(uri-match/spiffy
			`(((/ "")
			   (GET ,(lambda (c) (send-status 200 "TEST")))))))))
(vhost-map `((".*" . ,(uri-match/spiffy
			`(((/ "")
			   (GET ,(lambda (c)
				   (send-response
				     status: 'ok
				     body: "Hello World!"
				     headers: '((content-type text/html)))))))))))