use std::sync::Arc; use axum::routing::{delete, get, post}; use axum::Router; use crate::error::AppState; mod auth; mod common; mod files; mod spa; pub fn router(state: Arc) -> Router { Router::new() .route("/api/auth/login", post(auth::login)) .route("/api/auth/logout", post(auth::logout)) .route("/api/auth/me", get(auth::me)) .route("/api/auth/setup", post(auth::setup)) .route("/api/files/{root_id}", get(files::list_root)) .route("/api/files/{root_id}/{*path}", get(files::file_get)) .route("/api/files/{root_id}", post(files::dispatch_root)) .route("/api/files/{root_id}/{*path}", post(files::dispatch)) .route("/api/files/{root_id}/{*path}", delete(files::delete)) .fallback(spa::fallback) .with_state(state) }