How to route using ant patterns? #2756
Answered
by
robjtede
bandrefilipe
asked this question in
Q&A
-
I saw this discussion, but I can't get it to work. Sample code: #[actix_web::main]
async fn main() -> std::io::Result<()> {
let app = || {
App::new().route("/**", web::to(handle))
};
HttpServer::new(app)
.bind("127.0.0.1:8000")?
.run()
.await
}
async fn handle(_: HttpRequest) -> impl Responder {
HttpResponse::Ok()
} Testing it: curl -v 127.0.0.1:8000/test
* Trying 127.0.0.1:8000...
* Connected to 127.0.0.1 (127.0.0.1) port 8000 (#0)
> GET /test HTTP/1.1
> Host: 127.0.0.1:8000
> User-Agent: curl/7.79.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< content-length: 0
< date: Fri, 06 May 2022 15:03:37 GMT
<
* Connection #0 to host 127.0.0.1 left intact |
Beta Was this translation helpful? Give feedback.
Answered by
robjtede
May 6, 2022
Replies: 1 comment
-
I'm not sure how that's working for the OP of that discussion. Info on tail matching: https://actix.rs/actix-web/actix_web/dev/struct.ResourceDef.html#tail-segments |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
robjtede
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure how that's working for the OP of that discussion.
Info on tail matching: https://actix.rs/actix-web/actix_web/dev/struct.ResourceDef.html#tail-segments