Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I match the whole path? #54

Open
shashi opened this issue Jan 2, 2018 · 2 comments
Open

How do I match the whole path? #54

shashi opened this issue Jan 2, 2018 · 2 comments

Comments

@shashi
Copy link
Collaborator

shashi commented Jan 2, 2018

page("/foo/:key", server)

only matches one word keys like foo/bar. How do I match /foo/bar/baz?

@cmcaine
Copy link
Collaborator

cmcaine commented Dec 6, 2020

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
Copy link
Collaborator

cmcaine commented Dec 6, 2020

Oh, lol, you probably wrote this and know that well. I'll leave my comment in case users have the same question.

@cmcaine cmcaine mentioned this issue Dec 20, 2020
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants