use actix_web::{web, App, HttpServer, Responder};
fn index(info: web::Path<(u32, String)>) -> impl Responder {
format!("Hello {}! id:{}", info.1, info.0)
}
fn main() -> std::io::Result<()> {
HttpServer::new(
|| App::new().service(
web::resource("/{id}/{name}/index.html").to(index)))
.bind("127.0.0.1:8080")?
.run()
}
How do you know the HTTP method your path is called with?that example isn't very good.. here's what the resource-registration for "/products" endpoint would look like (note the http method), where I've lazily omitted "/products" a level above because I wanted you just to see the http methods:
web::resource("")
.route(web::get().to_async(products::get_products))
.route(web::post().to_async(products::add_product))
This syntax makes it look almost like [warp's](https://github.com/seanmonstar/warp) "filters".