(refactor) more clean architecture

This commit is contained in:
Rorik Star Platinum 2025-11-05 00:10:18 +03:00
parent 0a45d6e139
commit 8a03bdee96
8 changed files with 278 additions and 53 deletions

24
src/route.rs Normal file
View file

@ -0,0 +1,24 @@
// src/route.rs
// Почему это здесь?
// - Это центр управления всеми HTTP маршрутами (роутами)
// - Здесь объявляются все подмодули (handlers, будущие сервисы и т.д.)
// - Здесь собирается финальный Router для Axum
pub mod handlers; // Объявляем подмодуль handlers
use axum::{routing::get, Router};
use crate::AppState;
/// Создаёт и возвращает Router со всеми сконфигурированными роутами
/// Функция принимает AppState и передаёт его всем handlers'ам
pub fn router(app_state: AppState) -> Router {
Router::new()
// GET /api/health — health-check эндпоинт
.route("/api/health", get(handlers::health_handler))
// Сюда добавим новые роуты по мере разработки:
// .route("/api/accounts", get(handlers::accounts::get_accounts))
// .route("/api/payments", post(handlers::payments::create_payment))
.with_state(app_state)
}