diff --git a/src/api.rs b/src/form.rs similarity index 94% rename from src/api.rs rename to src/form.rs index 33f20ed..1533674 100644 --- a/src/api.rs +++ b/src/form.rs @@ -2,7 +2,7 @@ use futures::{StreamExt, TryStreamExt}; use ntex::web::{self, Error, HttpResponse}; use ntex_multipart::Multipart; -#[web::post("/api/upload")] +#[web::post("/form/upload")] async fn upload(mut payload: Multipart) -> Result { while let Ok(Some(mut field)) = payload.try_next().await { println!("CT: {:?}", field.content_type()); diff --git a/src/main.rs b/src/main.rs index 1c1613d..f28d37c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ use ntex::web::{self, App}; use ntex_files; -mod api; +mod form; mod pages; #[ntex::main] @@ -9,7 +9,7 @@ async fn main() -> std::io::Result<()> { web::server(move || { App::new() .service(pages::index) - .service(api::upload) + .service(form::upload) .service(ntex_files::Files::new("/static", "./static")) }) .bind("127.0.0.1:3002")? diff --git a/templates/index.hbs b/templates/index.hbs index 97ac065..118fa9d 100644 --- a/templates/index.hbs +++ b/templates/index.hbs @@ -18,7 +18,7 @@ -
+ {{> no-auto-submit }}
{{> file }} @@ -45,7 +45,7 @@
-