impl Responder { let url = req.uri().to_string(); HttpResponse::Ok().body(url) } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new() .service(echo) }) .bind(("127.0.0.1", 8080))? .run() .await }"> impl Responder { let url = req.uri().to_string(); HttpResponse::Ok().body(url) } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new() .service(echo) }) .bind(("127.0.0.1", 8080))? .run() .await }"> impl Responder { let url = req.uri().to_string(); HttpResponse::Ok().body(url) } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new() .service(echo) }) .bind(("127.0.0.1", 8080))? .run() .await }">
[dependencies]
actix-web = "4"
use actix_web::{get, App, HttpRequest, HttpResponse, HttpServer, Responder};
#[get("/customers")]
async fn echo(req: HttpRequest) -> impl Responder {
let url = req.uri().to_string();
HttpResponse::Ok().body(url)
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.service(echo)
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}