pub mod openapi; use axum::Router; use export::AppState; use session::{store, SessionLayer}; pub async fn router(state: AppState) -> Result { let store = store::connect(state.redis.clone(), &state.config.session).await?; let auth = auth::services::AuthService::new(state.clone()); let issues = issues::services::service::IssueService::new(state.clone()); let space = space::services::service::SpaceService::new(state.clone()); let user = user::services::service::UserService::new(state.clone()); let git = git::service::GitService::new(state); let router: Router = Router::new() .merge(auth::routes::router(auth.clone()).with_state(auth)) .merge(issues::routes::router(issues.clone()).with_state(issues)) .merge(space::routes::router(space.clone()).with_state(space)) .merge(user::routes::router(user.clone()).with_state(user)) .merge(git::routes::router(git.clone()).with_state(git)) .layer(SessionLayer::new(store)); Ok(router) }