-
Trying to use actix first time and basic example is not working for me: Cargo.toml [package]
name = "hello-world-actix"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-web = "4" main.rs use actix_web::{get, web, App, HttpServer, Responder};
#[get("/hello/{name}")]
async fn greet(name: web::Path<String>) -> impl Responder {
format!("Hello {name}!")
}
#[actix_web::main] // or #[tokio::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| App::new().service(greet))
.bind(("127.0.0.1", 8080))?
.run()
.await
} when I try to use
and it's not finishing. Tried rebuild using |
Beta Was this translation helpful? Give feedback.
Answered by
asonix
Aug 1, 2023
Replies: 1 comment 2 replies
-
The example is intended to run forever. it starts a web server and listens on localhost port 8080. It will continue listening until you stop it manually. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
nav-mike
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The example is intended to run forever. it starts a web server and listens on localhost port 8080. It will continue listening until you stop it manually.