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

Index path documentation #214

Closed
WillSquire opened this issue May 6, 2019 · 5 comments
Closed

Index path documentation #214

WillSquire opened this issue May 6, 2019 · 5 comments

Comments

@WillSquire
Copy link

Wasn't entirely clear on how to define an index route (i.e. "" or "/"), but found #118 which helped out. Not sure if some documentation on warp::path might make it easier to find for future users? I originally assumed warp::path::end() matched the URI backwards, i.e. "something/something/this", and warp::path() or warp::path("/") matched an index or something.

@seanmonstar
Copy link
Owner

I agree, the documentation there should be improved.

It also seems like the path! macro could do a better job of helping match full paths, and be less surprising in general (such as how path!("/my/file") will match /my/file/wat).

@WillSquire
Copy link
Author

Ah, yes that would definitely catch me out. Though I must say, so far it's an awesome framework. Style wise it just feels right. I tried doing something similar once and made a behaviour tree styled framework in Dart for backends, but this has the HTTP layer covered instead of just a plain old BT, and it's far easier to use! Are there any inverter decorates? I.e. paths that don't match the criteria (!)?

@seanmonstar
Copy link
Owner

Are there any inverter decorates? I.e. paths that don't match the criteria (!)?

Not built-in. I believe an inverter can be confusing to recognize what exactly it is doing. Particularly, is it just rejecting if the path doesn't match, or does it also "consume" that part of the path. What I mean is, assuming some sort of not(path("blog")), when it is applied to /company/about, and company isn't blog, would the next filter in the chain see just /about, or still /company/about?

@remram44
Copy link

Got tripped by both those issues today. Is there a way to have path!() not match additional components? And I was also expecting path!("") or path!() to match / (instead of a recursion error).

@seanmonstar
Copy link
Owner

warp v0.2 includes #359, which makes path!("foo" / "bar") require the path to end, and allows path!("foo" / "bar" / ..) to indicate a prefix.

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

3 participants