Include require auth middleware and login route

This commit is contained in:
GW_MC
2025-12-18 18:25:57 +08:00
parent b0c11c7c67
commit ccd8bc7aa1
15 changed files with 326 additions and 39 deletions

View File

@@ -1,13 +1,21 @@
mod auth;
mod health;
mod openapi;
mod restricted;
use std::sync::Arc;
use crate::routes::AppState;
pub use self::openapi::ApiDoc;
use axum::{Router, response::IntoResponse, routing::any};
pub fn get_api_router() -> Router {
pub fn get_api_router(state: Arc<AppState>) -> Router {
Router::new()
.nest("/health", health::get_health_router())
.merge(auth::get_basic_auth_router(state.clone()))
.merge(restricted::get_restricted_router(state.clone()))
// explicit fallback for unmatched API routes
.route("/{*wildcard}", any(api_fallback_handler))
}