// #[get("/")] // async fn hello(state : web::Data) -> impl Responder { // HttpResponse::Ok().body(format!("Hello world! {}", state.count_visit())) // } // // #[post("/echo")] // async fn echo(req_body: String) -> impl Responder { // HttpResponse::Ok().body(req_body) // } // async fn static_files(req: HttpRequest) -> actix_web::Result { // let path: PathBuf = req.match_info().query("filename").parse().unwrap(); // // // // Ok(NamedFile::open(path)?) // } // // #[get("/users/{user_id}/{friend}")] // <- define path parameters // async fn user_friend(web::Path((user_id, friend)): web::Path<(u32, String)>, state : web::Data) -> impl Responder { // HttpResponse::Ok() // .header("Content-Type", "text/html") // .body(format!("

Welcome {}, user_id {}!

Visitor nr {}\n", friend, user_id, state.count_visit())) // }