Implement basic middleware handling
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::Router;
|
||||
use axum::{Extension, Router};
|
||||
use migration::sea_orm::DatabaseConnection;
|
||||
|
||||
use crate::middlewares;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AppState {
|
||||
// TODO: remove dead_code allowances when fields are used
|
||||
#[allow(dead_code)]
|
||||
@@ -17,11 +20,12 @@ 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());
|
||||
let mut router = Router::new();
|
||||
|
||||
router = middlewares::apply_root_middleware(router);
|
||||
|
||||
router = router.layer(Extension(state.into()));
|
||||
|
||||
#[allow(clippy::let_and_return)]
|
||||
router
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user