Skip to content

Commit

Permalink
chore: update axum examples to axum 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaro00 committed Jan 3, 2024
1 parent e3bec67 commit 46dd853
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 29 deletions.
2 changes: 1 addition & 1 deletion axum/hello-world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
axum = "0.6.20"
axum = "0.7.3"
shuttle-axum = "0.35.0"
shuttle-runtime = "0.35.0"
tokio = "1.28.2"
Expand Down
2 changes: 1 addition & 1 deletion axum/jwt-authentication/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
axum = { version = "0.6.18", features = ["headers"] }
axum = { version = "0.7.3", features = ["headers"] }
jsonwebtoken = "8.3.0"
once_cell = "1.18.0"
serde = { version = "1.0.188", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion axum/metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
axum = "0.6.18"
axum = "0.7.3"
shuttle-axum = "0.35.0"
shuttle-runtime = "0.35.0"
shuttle-metadata = "0.35.0"
Expand Down
2 changes: 1 addition & 1 deletion axum/postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
axum = "0.6.18"
axum = "0.7.3"
serde = { version = "1.0.188", features = ["derive"] }
shuttle-axum = "0.35.0"
shuttle-runtime = "0.35.0"
Expand Down
4 changes: 2 additions & 2 deletions axum/static-files/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ edition = "2021"
publish = false

[dependencies]
axum = "0.6.18"
axum = "0.7.3"
shuttle-axum = "0.35.0"
shuttle-runtime = "0.35.0"
tokio = "1.28.2"
tower-http = { version = "0.4.0", features = ["fs"] }
tower-http = { version = "0.5.0", features = ["fs"] }
4 changes: 2 additions & 2 deletions axum/static-next-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ edition = "2021"
publish = false

[dependencies]
axum = "0.6.10"
axum-extra = { version = "0.4.2", features = ["spa"] }
axum = "0.7.3"
shuttle-axum = "0.35.0"
shuttle-runtime = "0.35.0"
tokio = "1.26.0"
tower-http = { version = "0.5.0", features = ["fs"] }
10 changes: 5 additions & 5 deletions axum/static-next-server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::path::PathBuf;

use axum::Router;
use axum_extra::routing::SpaRouter;
use tower_http::services::{ServeDir, ServeFile};

#[shuttle_runtime::main]
async fn axum() -> shuttle_axum::ShuttleAxum {
let router =
Router::new().merge(SpaRouter::new("/", PathBuf::from("static")).index_file("index.html"));
let router = Router::new().nest_service(
"/",
ServeDir::new("static").not_found_service(ServeFile::new("static/index.html")),
);

Ok(router.into())
}
10 changes: 5 additions & 5 deletions axum/turso/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ version = "0.1.0"
edition = "2021"

[dependencies]
axum = { version = "0.6.18" }
shuttle-axum = { version = "0.35.0" }
shuttle-runtime = { version = "0.35.0" }
shuttle-turso = { version = "0.35.0" }
axum = "0.7.3"
shuttle-axum = "0.35.0"
shuttle-runtime = "0.35.0"
shuttle-turso = "0.35.0"
libsql-client = "0.31.0"
tokio = { version = "1.26.0" }
tokio = "1.26.0"
serde = { version = "1.0.164", features = ["derive"] }
serde_json = "1.0.99"
7 changes: 3 additions & 4 deletions axum/websocket/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ version = "0.1.0"
edition = "2021"

[dependencies]
axum = { version = "0.6.18", features = ["ws"] }
axum = { version = "0.7.3", features = ["ws"] }
chrono = { version = "0.4.26", features = ["serde"] }
futures = "0.3.28"
hyper = { version = "0.14.26", features = ["client", "http2"] }
hyper-tls = "0.5.0"
reqwest = "0.11.23"
serde = { version = "1.0.163", features = ["derive"] }
serde_json = "1.0.96"
shuttle-axum = "0.35.0"
shuttle-runtime = "0.35.0"
tokio = "1.28.2"
tower-http = { version = "0.4.0", features = ["fs"] }
tower-http = { version = "0.5.0", features = ["fs"] }
7 changes: 1 addition & 6 deletions axum/websocket/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ use axum::{
};
use chrono::{DateTime, Utc};
use futures::{SinkExt, StreamExt};
use hyper::{Client, Uri};
use hyper_tls::HttpsConnector;
use serde::Serialize;
use shuttle_axum::ShuttleAxum;
use tokio::{
Expand Down Expand Up @@ -50,12 +48,9 @@ async fn axum() -> ShuttleAxum {
let state_send = state.clone();
tokio::spawn(async move {
let duration = Duration::from_secs(PAUSE_SECS);
let https = HttpsConnector::new();
let client = Client::builder().build::<_, hyper::Body>(https);
let uri: Uri = STATUS_URI.parse().unwrap();

loop {
let is_up = client.get(uri.clone()).await;
let is_up = reqwest::get(STATUS_URI).await;
let is_up = is_up.is_ok();

let response = Response {
Expand Down
2 changes: 1 addition & 1 deletion axum/with-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
axum = "0.6.10"
axum = "0.7.3"
shuttle-axum = "0.35.0"
shuttle-runtime = "0.35.0"
tokio = "1.26.0"

0 comments on commit 46dd853

Please sign in to comment.