Some ideas for uri-match successor pasted by DerGuteMoritz on Tue Nov 6 08:56:01 2012

(define (require-authentication routes)
  (adorn-handlers
   routes
   (lambda (continue)
     (if (authenticated?)
         (continue)
         (redirect-to "/login")))))

(define routes
  (match-routes
   `(((/ "some" "resource" (submatch (+ num)))
      (GET ,get-some-resource)
      (POST ,create-some-resource)
      ((/ "sub")
       (GET ,wtf))
      ((/ . rest)
       (GET ,catch-all)))
     ,@(require-authentication
        `(((/ "profile")
           (GET ,get-profile)
           (PUT ,update-profile)))))))

content negotiation added by DerGuteMoritz on Tue Nov 6 09:05:33 2012

(define (get-some-resource id)
  (let* ((id (string->number id))
         (resource (find-resource id)))
    (if resource
        ;; This will send a "406 Not Acceptable" response when no
        ;; content type could be negotiated
        (negotiating-content
         (xml (send-xml-response body: resource))
         (json (send-json-response body: resource)))
        (not-found))))