<a href="http://docs.racket-lang.org/web-server/run.html#(part._.Examples)">http://docs.racket-lang.org/web-server/run.html#(part._.Examples)</a><div><br></div><div>contains this...</div><div><br></div><div>&gt;&gt;&gt;</div>
<div><div>Suppose you wanted it to capture top-level requests:</div><div><br></div><div>(serve/servlet my-app</div><div>               #:servlet-regexp #rx&quot;&quot;)</div><div>&lt;&lt;&lt;</div><div><br></div><div>Where do you think a different example should go? Somewhere on</div>
<div><br></div><div><a href="http://docs.racket-lang.org/web-server/dispatch.html">http://docs.racket-lang.org/web-server/dispatch.html</a></div><div><br></div><div>?</div><br><div class="gmail_quote">On Fri, Dec 2, 2011 at 8:15 PM, Jordan Schatz <span dir="ltr">&lt;<a href="mailto:jordan@noionlabs.com">jordan@noionlabs.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Fri, Dec 02, 2011 at 06:23:38PM -0700, Jay McCarthy wrote:<br>
&gt; The blog-dispatch function returned by dispatch-rules has the contract<br>
&gt; &quot;request? -&gt; response?&quot; so you pass it in in place of &quot;start&quot; to<br>
&gt; serve/servlet:<br>
&gt;<br>
&gt; (serve/servlet blog-dispatch ...)<br>
&gt;<br>
&gt; It is not a &quot;dispatcher&quot; in the Web server&#39;s terminology. That&#39;s a<br>
&gt; &quot;connection? request? -&gt; void&quot; function and only low level functions use<br>
&gt; those.<br>
<br>
</div>----------------------------------------------------------------------<br>
#lang web-server<br>
<br>
(require web-server/dispatch<br>
         web-server/servlet-env)<br>
<br>
(define-values (blog-dispatch blog-url)<br>
  (dispatch-rules<br>
   [(&quot;&quot;) list-posts]<br>
   [(&quot;posts&quot; (string-arg)) review-post]))<br>
<br>
(define (list-posts req)<br>
  (response/xexpr<br>
   `(body &quot;list-posts&quot;)))<br>
<br>
(define (review-post req p)<br>
  (response/xexpr<br>
   `(body ,(string-append &quot;review-posts &quot; p))))<br>
<br>
;; ;; Doesn&#39;t work<br>
;; (serve/servlet blog-dispatch<br>
;;                #:port 8080<br>
;;                #:launch-browser? #t)<br>
;; ;; Doesn&#39;t work<br>
;; (serve/servlet blog-dispatch<br>
;;                #:port 8080<br>
;;                #:servlet-path &quot;/&quot;<br>
;;                #:launch-browser? #t)<br>
;; Works<br>
(serve/servlet blog-dispatch<br>
               #:port 8080<br>
               #:servlet-regexp #rx&quot;.*&quot; ;But is this &quot;the right way&quot;?<br>
               #:launch-browser? #t)<br>
----------------------------------------------------------------------<br>
<br>
Once I got it working, it makes sense; but maybe a more complete example<br>
could be added to the docs?<br>
<br>
Shalom,<br>
<font color="#888888">Jordan<br>
</font></blockquote></div><br><br clear="all"><div><br></div>-- <br>Jay McCarthy &lt;<a href="mailto:jay@cs.byu.edu" target="_blank">jay@cs.byu.edu</a>&gt;<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>&quot;The glory of God is Intelligence&quot; - D&amp;C 93<br>
</div>