Some more cleanup.
This commit is contained in:
+12
-14
@@ -1,3 +1,5 @@
|
||||
use axum::{http::StatusCode, routing::get};
|
||||
|
||||
use crate::error::AppError;
|
||||
|
||||
pub mod dtos;
|
||||
@@ -6,20 +8,16 @@ pub mod scheduled_transactions;
|
||||
pub mod transactions;
|
||||
|
||||
pub fn create_router(pool: sqlx::PgPool) -> axum::Router {
|
||||
let scheduled_transactions = scheduled_transactions::create_router();
|
||||
let transactions = transactions::create_router();
|
||||
|
||||
let api = axum::Router::new()
|
||||
.nest("/scheduled-transactions", scheduled_transactions)
|
||||
.nest("/transactions", transactions);
|
||||
|
||||
axum::Router::new()
|
||||
.nest(
|
||||
"/api",
|
||||
axum::Router::new()
|
||||
.nest(
|
||||
"/scheduled-transactions",
|
||||
scheduled_transactions::create_router(),
|
||||
)
|
||||
.nest("/transactions", transactions::create_router()),
|
||||
)
|
||||
.fallback(handle_fallback)
|
||||
.nest("/api", api)
|
||||
.route("/health", get(async || StatusCode::NO_CONTENT))
|
||||
.fallback(async || AppError::NotFound)
|
||||
.with_state(pool)
|
||||
}
|
||||
|
||||
async fn handle_fallback() -> AppError {
|
||||
AppError::NotFound
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user