PLT Scheme URL dispatch

Posted by Inaimathi on Stack Overflow See other posts from Stack Overflow or by Inaimathi
Published on 2010-05-21T01:44:31Z Indexed on 2010/05/21 1:50 UTC
Read the original article Hit count: 477

Filed under:
|
|
|
|

I'm trying to hook up URL dispatch with PLT Scheme. I've taken a look at the tutorial and the server documentation. I can figure out how to route requests to the same servlets.

Specific example:

(define (start request)
  (blog-dispatch request))

(define-values (blog-dispatch blog-url)
  (dispatch-rules
   (("") 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))

Assuming the above code running on a server listening 8080, localhost:8080/ goes to a page that says "list-posts". Going to localhost:8080/posts/test goes to a PLT "file not found" page (with the above code, I'd expect it to go to a page that says "review-post test").

It feels like I'm missing something small and obvious. Can anyone give me a hint?

© Stack Overflow or respective owner

Related posts about plt-scheme

Related posts about url