How do I match the whole path?
shashi opened this issue · 2 comments
shashi commented
page("/foo/:key", server)
only matches one word keys like foo/bar
. How do I match /foo/bar/baz
?
cmcaine commented
For posterity:
There's not a function for that. You would have to write your own middleware to do so, but that's not hard :)
You could fairly easily come up with some syntax and write custom middleware with the stuff in src/routing.jl
.
Alternatively, you can write something custom that handles paths however you like:
branch(req -> startswith(req[:path], "/foo/"),
req -> respond("The rest of the path is $(req[:path][5:end])")
)
cmcaine commented
Oh, lol, you probably wrote this and know that well. I'll leave my comment in case users have the same question.