d73052269fc69fbf84f243fdec30a86325bc51c6
[litoprism.git] / src / main.rs
1 use actix_web::{get, web, App, HttpServer, Responder};
2
3 #[get("/hello/{name}")]
4 async fn greet(name: web::Path<String>) -> impl Responder {
5 format!("Hello {name}!")
6 }
7
8 #[actix_web::main] // or #[tokio::main]
9 async fn main() -> std::io::Result<()> {
10 HttpServer::new(|| {
11 App::new().service(greet)
12 })
13 .bind(("127.0.0.1", 8080))?
14 .run()
15 .await
16 }