1
0
mirror of https://github.com/actix/actix-website synced 2025-02-23 12:43:02 +01:00
Ibraheem Ahmed 034a6f1890
Improve home page (#305)
* improve landing page

* revert navbar
2023-01-09 09:52:42 +00:00

22 lines
477 B
Rust

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