Files
vmall/apps/api/src/lib.rs
T
Chengdong ZhangandCursor 5e866d08f4 refactor(api): split Axum handlers into handler/service/repo modules
Keep the REST contract; move domain logic out of route files so checkout, fulfillment, and identity can be reused across customer, shop, and admin surfaces.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-18 14:59:36 +08:00

24 lines
539 B
Rust

pub mod auth;
pub mod config;
pub mod error;
pub mod http;
pub mod models;
pub mod money;
pub mod modules;
pub mod seed;
pub mod state;
use axum::{routing::get, Router};
use tower_http::{cors::CorsLayer, trace::TraceLayer};
use crate::state::AppState;
pub fn build_router(state: AppState) -> Router {
Router::new()
.route("/api/health", get(modules::health::health))
.nest("/api", modules::api_router())
.layer(TraceLayer::new_for_http())
.layer(CorsLayer::permissive())
.with_state(state)
}