mirror of
https://github.com/zzzzDev4/ias-tea-axum.git
synced 2025-04-21 07:41:21 +02:00
changed routing from POST
to PUT
where suitable
This commit is contained in:
parent
df8f7dd184
commit
ef5bcb20a5
1 changed files with 4 additions and 4 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Reference in a new issue