diff --git a/src/main.rs b/src/main.rs index b4fa924..c295702 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ use dmds_tokio_fs::FsHandle; use paper::Paper; use question::Question; use serde::Deserialize; -use tower_http::cors::{self, CorsLayer}; +use tower_http::cors::CorsLayer; mod paper; mod question; @@ -88,6 +88,7 @@ async fn main() { }; let router: Router<()> = Router::new() + .layer(CorsLayer::permissive()) .route("/questions/new", post(question::new::)) .route("/paper/post", post(paper::post::)) .route("/paper/get", get(paper::get::)) @@ -106,12 +107,6 @@ async fn main() { &format!("/{}/{}", config.mng_secret, config.mng_reject_papers_secret), post(paper::reject::), ) - .layer( - CorsLayer::new() - .allow_methods(cors::Any) - .allow_origin(cors::Any) - .allow_headers(cors::Any), - ) .with_state(state.clone()); tokio::spawn(dmds_tokio_fs::daemon(