diff options
author | Adam T. Carpenter <atc@53hor.net> | 2025-04-12 17:13:27 -0400 |
---|---|---|
committer | Adam T. Carpenter <atc@53hor.net> | 2025-04-12 17:13:27 -0400 |
commit | 7a56b66c6982441f957c1873a475ebcb4df98542 (patch) | |
tree | 0f2172df7f3c794df89ef2309dbce4fe3635c5cf /src/main.rs | |
parent | 9bd21d3d07b74fdd0e761be72592fdff1d546861 (diff) | |
download | carpentertutoring-7a56b66c6982441f957c1873a475ebcb4df98542.tar.xz carpentertutoring-7a56b66c6982441f957c1873a475ebcb4df98542.zip |
feat: cache things from /assets
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 252588d..372915b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,12 +7,14 @@ use tutors::fs_tutor_repo::FsTutorRepo; use std::{sync::Arc, env}; use tower_http::services::ServeDir; use posts::fs_post_repo::FsPostRepo; +use middleware::cache_control::cache_static; mod helpers; mod posts; mod tutors; mod views; mod handlers; +mod middleware; #[tokio::main] async fn main() { @@ -46,6 +48,7 @@ async fn main() { .nest_service("/assets", ServeDir::new(assets_dir)) .nest_service("/team", ServeDir::new(tutor_dir)) .fallback_service(ServeDir::new("static")) + .layer(axum::middleware::from_fn(cache_static)) .layer( TraceLayer::new_for_http() .make_span_with(trace::DefaultMakeSpan::new() |