multiberry-backend/src/route.rs

24 lines
1.2 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// src/route.rs
// Почему это здесь?
// - Это центр управления всеми HTTP маршрутами (роутами)
// - Здесь объявляются все подмодули (handlers, будущие сервисы и т.д.)
// - Здесь собирается финальный Router для Axum
pub mod handlers; // Объявляем подмодуль handlers
use axum::{routing::get, Router};
use crate::state::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/test-token", get(handlers::test_token_handler))
// Сюда добавим новые роуты по мере разработки:
// .route("/api/accounts", get(handlers::accounts::get_accounts))
// .route("/api/payments", post(handlers::payments::create_payment))
.with_state(app_state)
}