use actix_web::{get, HttpRequest, Result}; // #[get("/users/{userid}/{friend}")] // <- define path parameters async fn index(req: HttpRequest) -> Result { let name: String = req.match_info().get("friend").unwrap().parse().unwrap(); let userid: i32 = req.match_info().query("userid").parse().unwrap(); Ok(format!("Welcome {}, userid {}!", name, userid)) } #[actix_web::main] async fn main() -> std::io::Result<()> { use actix_web::{App, HttpServer}; HttpServer::new(|| App::new().service(index)) .bind("127.0.0.1:8080")? .run() .await } //