[racket] How to fit web-server/dispatchers/dispatch-files into dispatch-rules?
Hi all,
As the Racket Web Server doc shows, we can define URL dispatching rules as follows:
(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]))
If I want to make "blog-dispatch" as the only one dispatcher, I can do this:
(serve/servlet blog-dispatch #:servlet-regexp #rx".*")
Here's the problem - it captures all requests, including requests to static files,
which is not what I want - I'd expect that it treats requests that don't match
any rules as a request to a static file in the htdocs/ directory.
I've found the module "web-server/dispatchers/dispatch-files" that can serve static files,
but the "make" procedure in it returns a dispatcher, which cannot be passed to "dispatch-rules"
directly. How can I "convert" it to a normal request handler?
-Limbo Peng