Add serve function and remove Server re-export (#1868)

This commit is contained in:
David Pedersen
2023-03-23 20:25:36 +01:00
parent 2ae0cdf7cf
commit d153719bef
86 changed files with 641 additions and 564 deletions
+3 -4
View File
@@ -93,10 +93,9 @@ async fn redirect_http_to_https(ports: Ports) {
};
let addr = SocketAddr::from(([127, 0, 0, 1], ports.http));
tracing::debug!("http redirect listening on {}", addr);
axum::Server::bind(&addr)
.serve(redirect.into_make_service())
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
tracing::debug!("listening on {}", listener.local_addr().unwrap());
axum::serve(listener, redirect.into_make_service())
.await
.unwrap();
}