diff options
Diffstat (limited to 'examples/cors')
-rw-r--r-- | examples/cors/src/main.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/examples/cors/src/main.rs b/examples/cors/src/main.rs index a0a5e8d8..bbd19206 100644 --- a/examples/cors/src/main.rs +++ b/examples/cors/src/main.rs @@ -40,10 +40,8 @@ async fn main() { async fn serve(app: Router, port: u16) { let addr = SocketAddr::from(([127, 0, 0, 1], port)); - axum::Server::bind(&addr) - .serve(app.into_make_service()) - .await - .unwrap(); + let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); + axum::serve(listener, app).await.unwrap(); } async fn html() -> impl IntoResponse { |