Skip to content

Commit 49e0bca

Browse files
committed
feat: initialize backend server with core modules, security middleware, and configurations.
1 parent cb3379f commit 49e0bca

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

backend/src/handlers/frontend_proxy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use axum::{
44
};
55
use reqwest::Client;
66
use std::env;
7-
use crate::{db, models::SiteContent};
7+
use crate::db;
88

99
// Default frontend URL (internal Docker network)
1010
const DEFAULT_FRONTEND_URL: &str = "http://frontend";

backend/src/main.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -519,17 +519,15 @@ async fn main() {
519519

520520
.route("/api/health", get(|| async { "OK" }))
521521

522-
.with_state(pool.clone())
522+
// Serve index.html with server-side injection for root and fallback
523+
.route("/", get(handlers::frontend_proxy::serve_index))
524+
.route("/*path", get(handlers::frontend_proxy::serve_index))
525+
526+
.with_state(pool)
523527
.layer(middleware::from_fn(security_headers))
524528
.layer(cors)
525529
.layer(RequestBodyLimitLayer::new(PUBLIC_BODY_LIMIT));
526530

527-
// Serve index.html with server-side injection for root and fallback
528-
// This must be added AFTER API routes to ensure they take precedence
529-
app = app.route("/", get(handlers::frontend_proxy::serve_index))
530-
.route("/*path", get(handlers::frontend_proxy::serve_index))
531-
.with_state(pool);
532-
533531
if !trust_proxy_ip_headers {
534532
app = app.layer(middleware::from_fn(strip_untrusted_forwarded_headers));
535533
}

0 commit comments

Comments
 (0)