Welcome to the CHICKEN Scheme pasting service

uri-match pasted by andyjpb on Sat Jul 21 16:12:44 2012

#;3> (define m `(((/ "") (GET "Hello World"))))
#;4> m
(((/ "") (GET "Hello World")))
#;5> (make-uri-matcher m)
#<procedure (f_792 method237 path238)>
#;6> ((make-uri-matcher m) 'GET "/")
#<procedure (f_709)>
#;7> (((make-uri-matcher m) 'GET "/"))
"Hello World"

look what&#x27;s going on in uri-match/spiffy pasted by certainty on Sat Jul 21 16:18:52 2012

(define (uri-match/spiffy routes)
  (let ((match (make-uri-matcher routes)))
    (lambda (continue)
      (let ((handler (match (request-method (current-request))
                      (request-uri (current-request)))))
        (printf "HAVE HANDLER ~A~%" handler)
        (if handler 
            (with-headers (default-response-headers)
                          (lambda () (or (handler) (continue))))
            (continue))))))

using send-response pasted by andyjpb on Sat Jul 21 16:33:48 2012

(vhost-map `((".*" . ,(uri-match/spiffy `(((/ "") (GET ,(lambda (c) (send-response
								     code: 200
								     reason: "OK"
								     body: (with-output-to-string (lambda () (waffle-sxml->html knodium-demo-page)))

working example added by certainty on Sat Jul 21 16:48:05 2012

(use spiffy spiffy-uri-match intarweb  uri-match uri-common)

(define routes
  `(((/ "")
     (GET ,(lambda (c) (send-status 200 "FOO"))))))

(vhost-map `((".*" . ,(uri-match/spiffy routes))))

(parameterize ((debug-log (current-output-port)))
  (start-server ))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which module provides `string-intersperse'?
Visually impaired? Let me spell it for you (wav file) download WAV