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