refactor: extract service variable
This commit is contained in:
parent
c3334d41f9
commit
10cf09ee76
1 changed files with 4 additions and 6 deletions
10
src/main.rs
10
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::<SocketAddr>(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let service = app.into_make_service_with_connect_info::<SocketAddr>();
|
||||
|
||||
axum::serve(listener, service).await.unwrap();
|
||||
|
||||
tracing::debug!("listening on http://{}/", addr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue