Welcome to the CHICKEN Scheme pasting service

no title added by sz0ka on Sun Nov 18 21:35:25 2012

#!/usr/bin/env chicken

(use spiffy uri-common intarweb medea matchable tcp6)

(root-path "/var/www")

(vhost-map `(((* any) . ,(lambda (continue)
                           (match (uri-path (request-uri (current-request)))
                                  ['(/ "commit")
                                   ;; get data which should be committed                                                                                                                                                                       
                                   ;; do commit                                                                                                                                                                                                
                                   ;; send response that everything worked fine                                                                                                                                                                
                                   (send-response body: (json->string '((status . "ok")))
                                                  headers: '((content-type application/json)))]
                                  ['(/ "log")
                                   ;; read parameter, if we got a count parameter display latest n commits else                                                                                                                                
                                   ;; display just the newest                                                                                                                                                                                  
                                   (send-response body: (json->string '((foo . "bar")))
                                                  headers: '((content-type application/json)))]
                                  ['(/ "easteregg")
                                   (send-response body: (json->string `((status .  "ok")
                                                                        (ip . ,(remote-address))))
                                                  headers: '((content-type application/json)))]
                               (continue))))))

(print "Entering Quietzone")
(define listener (tcp-listen 1338))
(debug-log "log.txt")
(start-server listener: listener accept: tcp-accept addresses: tcp-addresses)

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which procedure can be used to check whether its argument is a string?
Visually impaired? Let me spell it for you (wav file) download WAV