From 10cf09ee762e581f9d6ab86cd1fafcde249f387d Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Thu, 21 Nov 2024 07:54:03 -0800 Subject: [PATCH] refactor: extract service variable --- src/main.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 78c6b7e..a525e69 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,12 +64,10 @@ async fn serve(app: Router) { // // Server creation let addr = SocketAddr::from(([0, 0, 0, 0], 3000)); let listener = tokio::net::TcpListener::bind(&addr).await.unwrap(); - axum::serve( - listener, - app.into_make_service_with_connect_info::(), - ) - .await - .unwrap(); + + let service = app.into_make_service_with_connect_info::(); + + axum::serve(listener, service).await.unwrap(); tracing::debug!("listening on http://{}/", addr); }