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