use axum::{ routing::{delete, get, patch, post, put}, Router, }; use crate::{handlers::*, state::AppState}; pub fn router() -> Router { Router::new() // auth .route("/auth/register", post(auth::post_register)) .route("/auth/login", post(auth::post_login)) // users — static paths before parameterised .route("/users/me", patch(users::patch_profile)) .route("/users/me/top-friends", put(social::put_top_friends)) .route("/users/{username}", get(users::get_user)) .route("/users/{username}/following", get(feed::get_following_handler)) .route("/users/{username}/followers", get(feed::get_followers_handler)) .route("/users/{username}/top-friends", get(social::get_top_friends_handler)) // follows & blocks (use {id} param) .route( "/users/{id}/follow", post(social::post_follow).delete(social::delete_follow), ) .route( "/users/{id}/block", post(social::post_block).delete(social::delete_block), ) // thoughts .route("/thoughts", post(thoughts::post_thought)) .route( "/thoughts/{id}", get(thoughts::get_thought_handler) .patch(thoughts::patch_thought) .delete(thoughts::delete_thought_handler), ) .route("/thoughts/{id}/thread", get(thoughts::get_thread_handler)) // likes & boosts .route( "/thoughts/{id}/like", post(social::post_like).delete(social::delete_like), ) .route( "/thoughts/{id}/boost", post(social::post_boost).delete(social::delete_boost), ) // feeds .route("/feed", get(feed::home_feed)) .route("/feed/public", get(feed::public_feed)) .route("/search", get(feed::search_handler)) // notifications .route("/notifications", get(notifications::list_notifications)) .route("/notifications/read-all", post(notifications::mark_all_read)) .route("/notifications/{id}/read", post(notifications::mark_notification_read)) // api keys .route( "/api-keys", get(api_keys::get_api_keys).post(api_keys::post_api_key), ) .route("/api-keys/{id}", delete(api_keys::delete_api_key_handler)) }