[racket] Web server and URL dispatch

From: Jordan Schatz (jordan at noionlabs.com)
Date: Fri Dec 2 20:17:20 EST 2011

Its unclear to me how to get url dispatch working...

#lang web-server
(require web-server/templates

(define-values (blog-dispatch blog-url) ;;blog-dispatch is our
                                        ;;new dispatcher?
   [("") list-posts]
   [("posts" (string-arg)) review-post]
   [("archive" (integer-arg) (integer-arg)) review-archive]
   [else list-posts]))

(define (list-posts req) `(list-posts))
(define (review-post req p) `(review-post ,p))
(define (review-archive req y m) `(review-archive ,y ,m))

(define (start)
   #:dispatch blog-dispatch ;;Start the server with our dispatcher?
   #:port 8080))

(start) ;;Doesn't start a server : (

I cant seem to get a server running that is using that dispatcher... Also
I presume its possible to mix "pretty" urls made by dispatch-rules and
embed/url ?


Posted on the users mailing list.