From 5ed96f8e8b9d9f19ee249f5c73a5a21ef6bca09f Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Tue, 17 Jun 2025 02:03:28 -0400 Subject: Reorganize and consolidate HTTP routes. HTTP routes are now defined in a single, unified module, pulling them out of the topical modules they were formerly part of. This is intended to improve the navigability of the codebase. Previously, finding the handler corresponding to a specific endpoint required prior familiarity, though in practice you could usually guess from topic area. Now, all routes are defined in `crate::routes`. Other than changing visibility, I've avoided making changes to the handlers at the ends of those routes. --- src/user/mod.rs | 6 ++---- src/user/routes/mod.rs | 17 +++-------------- 2 files changed, 5 insertions(+), 18 deletions(-) (limited to 'src/user') diff --git a/src/user/mod.rs b/src/user/mod.rs index f4c66ab..7ea3d26 100644 --- a/src/user/mod.rs +++ b/src/user/mod.rs @@ -6,10 +6,8 @@ mod history; mod id; pub mod password; pub mod repo; -mod routes; +pub mod routes; mod snapshot; mod validate; -pub use self::{ - event::Event, history::History, id::Id, password::Password, routes::router, snapshot::User, -}; +pub use self::{event::Event, history::History, id::Id, password::Password, snapshot::User}; diff --git a/src/user/routes/mod.rs b/src/user/routes/mod.rs index ade96cb..f9bbed7 100644 --- a/src/user/routes/mod.rs +++ b/src/user/routes/mod.rs @@ -1,14 +1,3 @@ -use axum::{Router, routing::post}; - -use crate::app::App; - -mod login; -mod logout; -mod password; - -pub fn router() -> Router { - Router::new() - .route("/api/password", post(password::post::handler)) - .route("/api/auth/login", post(login::post::handler)) - .route("/api/auth/logout", post(logout::post::handler)) -} +pub mod login; +pub mod logout; +pub mod password; -- cgit v1.2.3