diff --git a/examples/extractors/src/json_one.rs b/examples/extractors/src/json_one.rs index 46882cc..95453df 100644 --- a/examples/extractors/src/json_one.rs +++ b/examples/extractors/src/json_one.rs @@ -1,5 +1,5 @@ // -use actix_web::{get, web, App, HttpServer, Result}; +use actix_web::{post, web, App, HttpServer, Result}; use serde::Deserialize; #[derive(Deserialize)] @@ -8,15 +8,15 @@ struct Info { } /// deserialize `Info` from request's body -#[get("/")] -async fn index(info: web::Json) -> Result { +#[post("/submit")] +async fn submit(info: web::Json) -> Result { Ok(format!("Welcome {}!", info.username)) } // #[actix_web::main] async fn main() -> std::io::Result<()> { - HttpServer::new(|| App::new().service(index)) + HttpServer::new(|| App::new().service(submit)) .bind(("127.0.0.1", 8080))? .run() .await