Skip to content

Commit 019c5b2

Browse files
committed
Refactor project structure and update imports
Moved module declarations to src/lib.rs and updated main.rs to use the AxumKit crate-style imports. Removed redundant module declarations from main.rs and replaced tracing info log with println. Minor formatting fix in routes.rs.
1 parent c597c63 commit 019c5b2

File tree

3 files changed

+18
-22
lines changed

3 files changed

+18
-22
lines changed

src/api/v0/routes/routes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use utoipa_swagger_ui::SwaggerUi;
1010
/// API + Swagger UI 라우터 통합
1111
pub fn api_routes() -> Router<AppState> {
1212
let mut router = Router::new();
13-
13+
1414
#[cfg(debug_assertions)]
1515
{
1616
router = router.merge(SwaggerUi::new("/docs").url("/swagger.json", ApiDoc::merged()));

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pub mod api;
2+
pub mod config;
3+
pub mod connection;
4+
pub mod dto;
5+
pub mod entity;
6+
pub mod middleware;
7+
pub mod service;
8+
pub mod state;
9+
pub mod utils;

src/main.rs

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
use crate::api::v0::routes::routes::api_routes;
2-
use crate::config::db_config::DbConfig;
3-
use crate::middleware::cors::cors_layer;
4-
use crate::state::AppState;
5-
use crate::utils::logger::init_tracing;
6-
use axum::Router;
71
use std::net::SocketAddr;
8-
use tower_http::compression::CompressionLayer;
9-
use tracing::{error, info};
10-
use crate::connection::database::establish_connection;
11-
12-
mod api;
13-
mod config;
14-
mod connection;
15-
mod dto;
16-
mod entity;
17-
mod middleware;
18-
mod service;
19-
mod state;
20-
mod utils;
2+
use axum::Router;
3+
use AxumKit::api::v0::routes::routes::api_routes;
4+
use AxumKit::config::db_config::DbConfig;
5+
use AxumKit::connection::database::establish_connection;
6+
use AxumKit::middleware::cors::cors_layer;
7+
use AxumKit::state::AppState;
8+
use AxumKit::utils::logger::init_tracing;
219

2210
pub async fn run_server() -> anyhow::Result<()> {
2311
let conn = establish_connection().await;
@@ -30,12 +18,11 @@ pub async fn run_server() -> anyhow::Result<()> {
3018
let app = Router::new()
3119
.merge(api_routes())
3220
.layer(cors_layer())
33-
.layer(CompressionLayer::new())
3421
.with_state(AppState {
3522
conn
3623
});
3724

38-
info!("Starting server at: {}", server_url);
25+
println!("Starting server at: {}", server_url);
3926

4027
let listener = tokio::net::TcpListener::bind(&server_url).await?;
4128
axum::serve(

0 commit comments

Comments
 (0)