mirror of
https://github.com/actix/actix-website
synced 2025-01-22 16:15:56 +01:00
update homepage example
This commit is contained in:
parent
eff8c425a6
commit
91d61f5be6
@ -50,8 +50,8 @@
|
||||
<div class="actix-content">
|
||||
{{ highlight `use actix_web::{get, web, App, HttpServer, Responder};
|
||||
|
||||
#[get("/{name}")]
|
||||
async fn greet_person(name: web::Path<String>) -> impl Responder {
|
||||
#[get("/hello/{name}")]
|
||||
async fn greet(name: web::Path<String>) -> impl Responder {
|
||||
format!("Hello {name}!")
|
||||
}
|
||||
|
||||
@ -59,8 +59,8 @@ async fn greet_person(name: web::Path<String>) -> impl Responder {
|
||||
async fn main() -> std::io::Result<()> {
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
.route("/", web::get().to(|| async { "Hello World!" }))
|
||||
.service(greet_person)
|
||||
.route("/hello", web::get().to(|| async { "Hello World!" }))
|
||||
.service(greet)
|
||||
})
|
||||
.bind(("127.0.0.1", 8080))?
|
||||
.run()
|
||||
|
Loading…
x
Reference in New Issue
Block a user