1
0
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:
Rob Ede 2022-03-05 23:34:28 +00:00
parent eff8c425a6
commit 91d61f5be6
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933

View File

@ -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()