mod.rs
| 1 | use std::sync::Arc; |
| 2 | |
| 3 | use axum::routing::{get, post}; |
| 4 | use axum::Router; |
| 5 | |
| 6 | use crate::error::AppState; |
| 7 | |
| 8 | mod auth; |
| 9 | mod spa; |
| 10 | |
| 11 | pub fn router(state: Arc<AppState>) -> Router { |
| 12 | Router::new() |
| 13 | .route("/api/auth/login", post(auth::login)) |
| 14 | .route("/api/auth/logout", post(auth::logout)) |
| 15 | .route("/api/auth/me", get(auth::me)) |
| 16 | .route("/api/auth/setup", post(auth::setup)) |
| 17 | .fallback(spa::fallback) |
| 18 | .with_state(state) |
| 19 | } |
| 20 |