The blog-dispatch function returned by dispatch-rules has the contract "request? -> response?" so you pass it in in place of "start" to serve/servlet:<div><br></div><div>(serve/servlet blog-dispatch ...)</div>
<div><br></div><div>It is not a "dispatcher" in the Web server's terminology. That's a "connection? request? -> void" function and only low level functions use those.<br><div><br></div><div>
The URLs from blog-url and embed/url (& send/suspend's friends) can be freely mixed.</div><div><br></div><div>Jay<br><div><br><div class="gmail_quote">On Fri, Dec 2, 2011 at 6:17 PM, Jordan Schatz <span dir="ltr"><<a href="mailto:jordan@noionlabs.com">jordan@noionlabs.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Its unclear to me how to get url dispatch working...<br>
<br>
----------------------------------------------------------------------<br>
#lang web-server<br>
(require web-server/templates<br>
web-server/dispatch<br>
web-server/web-server)<br>
<br>
(define-values (blog-dispatch blog-url) ;;blog-dispatch is our<br>
;;new dispatcher?<br>
(dispatch-rules<br>
[("") list-posts]<br>
[("posts" (string-arg)) review-post]<br>
[("archive" (integer-arg) (integer-arg)) review-archive]<br>
[else list-posts]))<br>
<br>
(define (list-posts req) `(list-posts))<br>
(define (review-post req p) `(review-post ,p))<br>
(define (review-archive req y m) `(review-archive ,y ,m))<br>
<br>
(define (start)<br>
(serve<br>
#:dispatch blog-dispatch ;;Start the server with our dispatcher?<br>
#:port 8080))<br>
<br>
(start) ;;Doesn't start a server : (<br>
----------------------------------------------------------------------<br>
<br>
I cant seem to get a server running that is using that dispatcher... Also<br>
I presume its possible to mix "pretty" urls made by dispatch-rules and<br>
embed/url ?<br>
<br>
Thanks,<br>
Jordan<br>
_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Jay McCarthy <<a href="mailto:jay@cs.byu.edu" target="_blank">jay@cs.byu.edu</a>><br>Assistant Professor / Brigham Young University<br><a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
<br>"The glory of God is Intelligence" - D&C 93<br>
</div></div></div>