4
0
Fork 0
mirror of https://github.com/zzzzDev4/ias-tea-axum.git synced 2025-04-21 07:41:21 +02:00

added allow_headers call

This commit is contained in:
zzzz 2024-06-16 17:19:25 +02:00
parent ef5bcb20a5
commit 38101afe8e

View file

@ -3,8 +3,7 @@
// cargo shuttle resource list --show-secrets
use axum::{
routing::{get, post, put, delete},
Router,
http, routing::{delete, get, post, put}, Router
};
use axum::http::Method;
use data::MyState;
@ -47,6 +46,7 @@ async fn main(#[shuttle_shared_db::Postgres] pool: PgPool) -> shuttle_axum::Shut
.with_state(state)
.layer(tower_http::cors::CorsLayer::new()
.allow_methods([Method::GET, Method::POST, Method::PUT, Method::DELETE])
.allow_headers([http::header::CONTENT_TYPE])
.allow_origin(tower_http::cors::Any));
Ok(router.into())