diff --git a/.gitignore b/.gitignore index ea8c4bf..f8eb791 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /target +config.toml +/db diff --git a/Cargo.lock b/Cargo.lock index 7b3f0ad..a65e869 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1218,6 +1218,7 @@ dependencies = [ "pin-project-lite", "tower-layer", "tower-service", + "tracing", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 92f57a4..6b71f13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ toml = "0.8" thiserror = "1.0" fastrand = "2.0" siphasher = "1.0" -tower-http = { version = "0.5", features = ["cors"] } +tower-http = { version = "0.5", features = ["cors", "trace"] } [dev-dependencies] tower = "0.4" diff --git a/src/main.rs b/src/main.rs index 12fe378..2bba95e 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::CorsLayer; +use tower_http::{cors::CorsLayer, trace::TraceLayer}; mod paper; mod question; @@ -88,6 +88,7 @@ async fn main() { }; let router: Router<()> = Router::new() + .layer(TraceLayer::new_for_http()) .route("/questions/new", post(question::new::)) .route("/paper/post", post(paper::post::)) .route("/paper/get", get(paper::get::)) @@ -106,8 +107,8 @@ async fn main() { &format!("/{}/{}", config.mng_secret, config.mng_reject_papers_secret), post(paper::reject::), ) - .with_state(state.clone()) - .layer(CorsLayer::very_permissive()); + .layer(CorsLayer::permissive()) + .with_state(state.clone()); tokio::spawn(dmds_tokio_fs::daemon( state.papers.clone(),