From ef5bcb20a56c643830ffd4fb81ee6a7ea9d9f386 Mon Sep 17 00:00:00 2001 From: zzzz Date: Sun, 16 Jun 2024 17:18:40 +0200 Subject: [PATCH] changed routing from `POST` to `PUT` where suitable --- src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index df3b449..3ff5ef2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ // cargo shuttle resource list --show-secrets use axum::{ - routing::{get, post, delete}, + routing::{get, post, put, delete}, Router, }; use axum::http::Method; @@ -27,12 +27,12 @@ async fn main(#[shuttle_shared_db::Postgres] pool: PgPool) -> shuttle_axum::Shut .nest_service("/", ServeFile::new("assets/index.html")) // configuration .route("/configuration", get(retrieve_config)) - .route("/configuration", post(update_config)) + .route("/configuration", put(update_config)) // brewing events .route("/brewing-events", get(retrieve_brewing_events)) // types of tea (update tea metadata, no log entry for steeping time) .route("/types-of-tea", get(retrieve_types_of_tea)) - .route("/types-of-tea/:id", post(update_tea_meta_by_id)) + .route("/types-of-tea/:id", put(update_tea_meta_by_id)) .route("/types-of-tea/:id", get(retrieve_tea_by_id)) // trigger log entry of steeping time .route( @@ -46,7 +46,7 @@ async fn main(#[shuttle_shared_db::Postgres] pool: PgPool) -> shuttle_axum::Shut //.route("/update-tea", post(update_tea_by_rfid)) // probably already covered by "update_tea_by_id" .with_state(state) .layer(tower_http::cors::CorsLayer::new() - .allow_methods([Method::GET, Method::POST, Method::DELETE]) + .allow_methods([Method::GET, Method::POST, Method::PUT, Method::DELETE]) .allow_origin(tower_http::cors::Any)); Ok(router.into())