You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
900 B
25 lines
900 B
|
|
|
|
// #[get("/")]
|
|
// async fn hello(state : web::Data<VisitCounter>) -> 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<NamedFile> {
|
|
// 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<VisitCounter>) -> impl Responder {
|
|
// HttpResponse::Ok()
|
|
// .header("Content-Type", "text/html")
|
|
// .body(format!("<h1>Welcome {}, user_id {}!</h1>Visitor nr {}\n", friend, user_id, state.count_visit()))
|
|
// }
|
|
|