Skip to content

Commit 9f297a1

Browse files
committed
feat: Initialize backend server with Axum, database, authentication, and API routes.
1 parent bcfaa8b commit 9f297a1

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

backend/src/main.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
// Module declarations for organizing the backend codebase
3-
mod auth; // Authentication and JWT token management
4-
mod csrf; // Cross-Site Request Forgery protection
5-
mod db; // Database connection and pooling
6-
mod handlers; // HTTP request handlers organized by feature
7-
mod models; // Data structures and database models
8-
mod middleware; // Middleware modules
9-
mod repositories; // Repository modules
3+
pub mod auth; // Authentication and JWT token management
4+
pub mod csrf; // Cross-Site Request Forgery protection
5+
pub mod db; // Database connection and pooling
6+
pub mod handlers; // HTTP request handlers organized by feature
7+
pub mod models; // Data structures and database models
8+
pub mod middleware; // Middleware modules
9+
pub mod repositories; // Repository modules
1010

1111
use crate::middleware::{cors, security};
1212

@@ -189,7 +189,7 @@ async fn main() {
189189
.expect("Failed to build governor config"),
190190
);
191191

192-
let login_router = Router::new()
192+
let login_router: Router<db::DbPool> = Router::default()
193193
.route("/api/auth/login", post(handlers::auth::login))
194194
.route("/api/auth/logout", post(handlers::auth::logout))
195195
.layer(RequestBodyLimitLayer::new(LOGIN_BODY_LIMIT))
@@ -204,7 +204,7 @@ async fn main() {
204204
.expect("Failed to build governor config for write routes"),
205205
);
206206

207-
let admin_routes = Router::new()
207+
let admin_routes: Router<db::DbPool> = Router::default()
208208

209209
.route("/api/tutorials", post(handlers::tutorials::create_tutorial))
210210
.route(

0 commit comments

Comments
 (0)