use actix_web::{get, web, App, HttpServer, Responder}; | |
async fn index() -> impl Responder { | |
"Hello, World!" | |
} | |
async fn hello(name: web::Path<String>) -> impl Responder { | |
format!("Hello {}!", &name) | |
} | |
async fn main() -> std::io::Result<()> { | |
HttpServer::new(|| App::new().service(index).service(hello)) | |
.bind(("127.0.0.1", 9090))? | |
.run() | |
.await | |
} |