summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2025-04-12 17:13:27 -0400
committerAdam T. Carpenter <atc@53hor.net>2025-04-12 17:13:27 -0400
commit7a56b66c6982441f957c1873a475ebcb4df98542 (patch)
tree0f2172df7f3c794df89ef2309dbce4fe3635c5cf /src/main.rs
parent9bd21d3d07b74fdd0e761be72592fdff1d546861 (diff)
downloadcarpentertutoring-7a56b66c6982441f957c1873a475ebcb4df98542.tar.xz
carpentertutoring-7a56b66c6982441f957c1873a475ebcb4df98542.zip
feat: cache things from /assets
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs3
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()