mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-23 00:00:15 +02:00
Add serve function and remove Server re-export (#1868)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user