refactor: extract service variable

This commit is contained in:
Zynh Ludwig 2024-11-21 07:54:03 -08:00
parent c3334d41f9
commit 10cf09ee76

View file

@ -64,12 +64,10 @@ async fn serve(app: Router) {
// // Server creation // // Server creation
let addr = SocketAddr::from(([0, 0, 0, 0], 3000)); let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap(); let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
axum::serve(
listener, let service = app.into_make_service_with_connect_info::<SocketAddr>();
app.into_make_service_with_connect_info::<SocketAddr>(),
) axum::serve(listener, service).await.unwrap();
.await
.unwrap();
tracing::debug!("listening on http://{}/", addr); tracing::debug!("listening on http://{}/", addr);
} }