http://docs.racket-lang.org/web-server/run.html#(part._.Examples)
contains this... >>> Suppose you wanted it to capture top-level requests: (serve/servlet my-app #:servlet-regexp #rx"") <<< Where do you think a different example should go? Somewhere on http://docs.racket-lang.org/web-server/dispatch.html ? On Fri, Dec 2, 2011 at 8:15 PM, Jordan Schatz <jor...@noionlabs.com> wrote: > On Fri, Dec 02, 2011 at 06:23:38PM -0700, Jay McCarthy wrote: > > 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: > > > > (serve/servlet blog-dispatch ...) > > > > 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. > > ---------------------------------------------------------------------- > #lang web-server > > (require web-server/dispatch > web-server/servlet-env) > > (define-values (blog-dispatch blog-url) > (dispatch-rules > [("") list-posts] > [("posts" (string-arg)) review-post])) > > (define (list-posts req) > (response/xexpr > `(body "list-posts"))) > > (define (review-post req p) > (response/xexpr > `(body ,(string-append "review-posts " p)))) > > ;; ;; Doesn't work > ;; (serve/servlet blog-dispatch > ;; #:port 8080 > ;; #:launch-browser? #t) > ;; ;; Doesn't work > ;; (serve/servlet blog-dispatch > ;; #:port 8080 > ;; #:servlet-path "/" > ;; #:launch-browser? #t) > ;; Works > (serve/servlet blog-dispatch > #:port 8080 > #:servlet-regexp #rx".*" ;But is this "the right way"? > #:launch-browser? #t) > ---------------------------------------------------------------------- > > Once I got it working, it makes sense; but maybe a more complete example > could be added to the docs? > > Shalom, > Jordan > -- Jay McCarthy <j...@cs.byu.edu> Assistant Professor / Brigham Young University http://faculty.cs.byu.edu/~jay "The glory of God is Intelligence" - D&C 93
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users