diff --git a/axum/starwars/Cargo.toml b/axum/starwars/Cargo.toml index ea26bb2..5340b0d 100644 --- a/axum/starwars/Cargo.toml +++ b/axum/starwars/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread"] } starwars = { path = "../../models/starwars" } -hyper = "0.14" -axum = { version = "0.6.0", features = ["headers"] } +hyper = "1.0.1" +axum = { version = "0.7.1" } diff --git a/axum/starwars/src/main.rs b/axum/starwars/src/main.rs index dea53f9..01d7001 100644 --- a/axum/starwars/src/main.rs +++ b/axum/starwars/src/main.rs @@ -3,8 +3,9 @@ use async_graphql_axum::GraphQL; use axum::{ response::{self, IntoResponse}, routing::get, - Router, Server, + Router, }; +use tokio::net::TcpListener; use starwars::{QueryRoot, StarWars}; async fn graphiql() -> impl IntoResponse { @@ -21,8 +22,8 @@ async fn main() { println!("GraphiQL IDE: http://localhost:8000"); - Server::bind(&"127.0.0.1:8000".parse().unwrap()) - .serve(app.into_make_service()) + let listener = TcpListener::bind("127.0.0.1:8000").await.unwrap(); + axum::serve(listener, app.into_make_service()) .await .unwrap(); } diff --git a/axum/subscription/Cargo.toml b/axum/subscription/Cargo.toml index 6a13791..b509995 100644 --- a/axum/subscription/Cargo.toml +++ b/axum/subscription/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread"] } books = { path = "../../models/books" } -hyper = "0.14" -axum = { version = "0.6.0", features = ["ws", "headers"] } +hyper = "1.0.1" +axum = { version = "0.7.1", features = ["ws"] } diff --git a/axum/subscription/src/main.rs b/axum/subscription/src/main.rs index 46cee97..a83f7bd 100644 --- a/axum/subscription/src/main.rs +++ b/axum/subscription/src/main.rs @@ -3,8 +3,9 @@ use async_graphql_axum::{GraphQL, GraphQLSubscription}; use axum::{ response::{self, IntoResponse}, routing::get, - Router, Server, + Router }; +use tokio::net::TcpListener; use books::{MutationRoot, QueryRoot, Storage, SubscriptionRoot}; async fn graphiql() -> impl IntoResponse { @@ -31,8 +32,8 @@ async fn main() { println!("GraphiQL IDE: http://localhost:8000"); - Server::bind(&"127.0.0.1:8000".parse().unwrap()) - .serve(app.into_make_service()) + let listener = TcpListener::bind("127.0.0.1:8000").await.unwrap(); + axum::serve(listener, app.into_make_service()) .await .unwrap(); } diff --git a/axum/token-from-header/Cargo.toml b/axum/token-from-header/Cargo.toml index 612b3de..99fc5ed 100644 --- a/axum/token-from-header/Cargo.toml +++ b/axum/token-from-header/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread"] } token = { path = "../../models/token" } -hyper = "0.14" -axum = { version = "0.6.0", features = ["ws", "headers"] } +hyper = "1.0.1" +axum = { version = "0.7.1", features = ["ws"] } \ No newline at end of file diff --git a/axum/token-from-header/src/main.rs b/axum/token-from-header/src/main.rs index 44a886c..387c96b 100644 --- a/axum/token-from-header/src/main.rs +++ b/axum/token-from-header/src/main.rs @@ -8,8 +8,9 @@ use axum::{ http::header::HeaderMap, response::{Html, IntoResponse, Response}, routing::get, - Router, Server, + Router, }; +use tokio::net::TcpListener; use token::{on_connection_init, QueryRoot, SubscriptionRoot, Token, TokenSchema}; async fn graphql_playground() -> impl IntoResponse { @@ -61,8 +62,8 @@ async fn main() { println!("Playground: http://localhost:8000"); - Server::bind(&"127.0.0.1:8000".parse().unwrap()) - .serve(app.into_make_service()) + let listener = TcpListener::bind("127.0.0.1:8000").await.unwrap(); + axum::serve(listener, app.into_make_service()) .await .unwrap(); } diff --git a/axum/upload/Cargo.toml b/axum/upload/Cargo.toml index e074bd4..a941b27 100644 --- a/axum/upload/Cargo.toml +++ b/axum/upload/Cargo.toml @@ -7,8 +7,8 @@ edition = "2021" [dependencies] async-graphql = { path = "../../.." } async-graphql-axum = { path = "../../../integrations/axum" } -axum = "0.6.0" +axum = "0.7.1" files = { path = "../../models/files" } -tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -hyper = "0.14" -tower-http = { version = "0.2.1", features = ["cors"] } +tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread"] } +hyper = "1.0.1" +tower-http = { version = "0.5.0", features = ["cors"] } diff --git a/axum/upload/src/main.rs b/axum/upload/src/main.rs index a334cc6..92852a7 100644 --- a/axum/upload/src/main.rs +++ b/axum/upload/src/main.rs @@ -6,8 +6,9 @@ use axum::{ Router, }; use files::{MutationRoot, QueryRoot, Storage}; -use hyper::{Method, Server}; -use tower_http::cors::{CorsLayer, Origin}; +use hyper::Method; +use tower_http::cors::{CorsLayer, AllowOrigin}; +use tokio::net::TcpListener; async fn graphiql() -> impl IntoResponse { Html(GraphiQLSource::build().endpoint("/").finish()) @@ -25,12 +26,12 @@ async fn main() { .route("/", get(graphiql).post_service(GraphQL::new(schema))) .layer( CorsLayer::new() - .allow_origin(Origin::predicate(|_, _| true)) + .allow_origin(AllowOrigin::predicate(|_, _| true)) .allow_methods(vec![Method::GET, Method::POST]), ); - Server::bind(&"127.0.0.1:8000".parse().unwrap()) - .serve(app.into_make_service()) + let listener = TcpListener::bind("127.0.0.1:8000").await.unwrap(); + axum::serve(listener, app.into_make_service()) .await .unwrap(); }