I think you need your servlet regexp to not match /static/
Something like this?

   #:servlet-regexp #rx"^(?<!static/).*"

(I’m not sure about the forward-slash it may or may not need escaping)

Kind regards

Stephen


On 30 Jan 2019, at 17:12, Christopher Lemmer Webber <cweb...@dustycloud.org>
wrote:

Thanks!  It's true that the #:extra-files-paths works fine if I'm happy
enough with its contents not being "mounted" under a separate path.  I
guess that's fine for now, though I really would like to figure out how
to compose servlets and dispatchers the "proper" way. :)

Stephen De Gabrielle writes:

Hi


The contine tutorial has a good bit on serving static files:


The bit on #:extra-files-paths:

https://docs.racket-lang.org/continue/index.html#%28part._.Leaving_.Dr.Racket%29



This is what I did

https://github.com/spdegabrielle/clash

main.rkt


Sorry bit of a rush- let me know if I’m making sense - I can do a smaller

example to your spec this evening.


Stephen



On Wed, 30 Jan 2019 at 16:42, Christopher Lemmer Webber <

cweb...@dustycloud.org> wrote:


It seems like it should be so simple, and like Racket has the tools

already, but I can't figure out how to do it.


I have the following:


 (serve/servlet start

                #:servlet-regexp #rx""

                #:launch-browser? #f)


I'd like to do something like the following:


 - Serve static files for urls matching /static/*

 - Serve those very files from the ./static/ directory


I'd expect I'd do something like combine that all with:


 (file-dispatch:make #:url->path (make-url->path

                                   (build-path cwd "static")))


But I'm lost.  I can figure out how to serve static files OR use the

controllers in my start function, but combining them....???  I'd like to

serve some static files *in addition* to my the above code.  Between

dispatchers and servlets and even the file serving dispatchers, I

thought I could figure out something relatively easy out of the box.

But hours later I'm still scratching my head about how to combine

servlets or dispatchers or what have you.


I've read a bunch of things:

- https://www.greghendershott.com/2013/03/serve-static-files.html

- https://docs.racket-lang.org/web-server-internal/dispatch-files.html

-

https://docs.racket-lang.org/web-server-internal/dispatch-sequencer.html

- and pretty much everything under

https://docs.racket-lang.org/web-server/


... but I can't figure out how to do it without reinventing all the

machinery that appears to already exist in Racket.  There must be

something obvious and simple right in front of me.


--

You received this message because you are subscribed to the Google Groups

"Racket Users" group.

To unsubscribe from this group and stop receiving emails from it, send an

email to racket-users+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



-- 
----

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to