Basic route structure

This commit is contained in:
GW_MC
2025-11-27 18:50:11 +08:00
parent e849b71a40
commit bb622df89b
2 changed files with 39 additions and 1 deletions

33
apps/api/src/routes.rs Normal file
View File

@@ -0,0 +1,33 @@
use std::sync::Arc;
use axum::Router;
use migration::sea_orm::DatabaseConnection;
pub struct AppState {
pub database_connection: DatabaseConnection,
pub service: Arc<AppService>,
}
pub struct AppService {
//
}
pub fn get_root_router(state: impl Into<Arc<AppState>>) -> Router {
let router = Router::new()
// TODO: Add routes
.with_state(state.into());
#[allow(clippy::let_and_return)]
router
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn ensure_state_send_sync() {
fn assert_send_sync<T: Send + Sync>() {}
assert_send_sync::<AppState>();
}
}