Skip to content

Commit b3c8619

Browse files
author
zerox80
committed
feat: implement initial Axum backend server setup with API routing, security, and data management.
1 parent 5b9468c commit b3c8619

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

backend/src/main.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,15 @@ async fn main() {
258258

259259
.layer(RequestBodyLimitLayer::new(ADMIN_BODY_LIMIT))
260260

261-
.layer(GovernorLayer::new(admin_rate_limit_config.clone()));
261+
.layer(GovernorLayer::new(admin_rate_limit_config.clone()))
262+
.with_state(pool.clone());
262263

263264
// Define the application router with all routes and middleware
265+
let login_router_with_state = login_router.with_state(pool.clone());
266+
264267
let mut app = Router::default()
265268
// Merge all route modules
266-
.merge(login_router)
269+
.merge(login_router_with_state)
267270

268271
.route("/api/auth/me", get(handlers::auth::me))
269272

@@ -299,7 +302,6 @@ async fn main() {
299302
"/api/posts/{id}/comments",
300303
get(handlers::comments::list_post_comments)
301304
.post(handlers::comments::create_post_comment)
302-
.route_layer(from_extractor::<csrf::CsrfGuard>())
303305
.route_layer(GovernorLayer::new(admin_rate_limit_config.clone())),
304306
)
305307
.route(

0 commit comments

Comments
 (0)