cargo upgrade and use trailing slash route extra

This commit is contained in:
Bryan Stitt 2023-01-06 14:22:57 -08:00
parent eb3fe0b1b5
commit 5bfba3a87a
7 changed files with 33 additions and 20 deletions

28
Cargo.lock generated

@ -405,6 +405,25 @@ dependencies = [
"tower-service",
]
[[package]]
name = "axum-extra"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a320103719de37b7b4da4c8eb629d4573f6bcfd3dfe80d3208806895ccf81d"
dependencies = [
"axum",
"bytes",
"futures-util",
"http",
"mime",
"pin-project-lite",
"tokio",
"tower",
"tower-http",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum-macros"
version = "0.3.0"
@ -2061,9 +2080,9 @@ checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
[[package]]
name = "glob"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "group"
@ -4983,9 +5002,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.23.1"
version = "1.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38a54aca0c15d014013256222ba0ebed095673f89345dd79119d912eb561b7a8"
checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae"
dependencies = [
"autocfg",
"bytes",
@ -5536,6 +5555,7 @@ dependencies = [
"argh",
"axum",
"axum-client-ip",
"axum-extra",
"axum-macros",
"chrono",
"counter",

@ -11,4 +11,4 @@ anyhow = "1.0.68"
hashbrown = "0.13.1"
log = "0.4.17"
moka = { version = "0.9.6", default-features = false, features = ["future"] }
tokio = "1.23.1"
tokio = "1.24.1"

@ -9,7 +9,7 @@ name = "migration"
path = "src/lib.rs"
[dependencies]
tokio = { version = "1.23.1", features = ["full", "tracing"] }
tokio = { version = "1.24.1", features = ["full", "tracing"] }
[dependencies.sea-orm-migration]
version = "0.10.6"

@ -7,4 +7,4 @@ edition = "2021"
[dependencies]
anyhow = "1.0.68"
deadpool-redis = { version = "0.11.1", features = ["rt_tokio_1", "serde"] }
tokio = "1.23.1"
tokio = "1.24.1"

@ -60,7 +60,7 @@ serde_json = { version = "1.0.91", default-features = false, features = ["alloc"
serde_prometheus = "0.1.6"
# TODO: make sure this time version matches siwe. PR to put this in their prelude
time = "0.3.17"
tokio = { version = "1.23.1", features = ["full"] }
tokio = { version = "1.24.1", features = ["full"] }
# TODO: make sure this uuid version matches sea-orm. PR to put this in their prelude
tokio-stream = { version = "0.1.11", features = ["sync"] }
toml = "0.5.10"
@ -70,4 +70,5 @@ ulid = { version = "1.0.0", features = ["serde"] }
url = "2.3.1"
uuid = "1.2.2"
itertools = "0.10.5"
glob = "0.3.0"
glob = "0.3.1"
axum-extra = "0.4.2"

@ -13,6 +13,7 @@ use axum::{
routing::{get, post, put},
Extension, Router,
};
use axum_extra::routing::RouterExt;
use http::header::AUTHORIZATION;
use log::info;
use moka::future::Cache;
@ -45,22 +46,14 @@ pub async fn serve(port: u16, proxy_app: Arc<Web3ProxyApp>) -> anyhow::Result<()
// routes should be ordered most to least common
.route("/", post(rpc_proxy_http::proxy_web3_rpc))
.route("/", get(rpc_proxy_ws::websocket_handler))
.route(
.route_with_tsr(
"/rpc/:rpc_key",
post(rpc_proxy_http::proxy_web3_rpc_with_key),
)
.route(
"/rpc/:rpc_key/",
post(rpc_proxy_http::proxy_web3_rpc_with_key),
)
.route(
.route_with_tsr(
"/rpc/:rpc_key",
get(rpc_proxy_ws::websocket_handler_with_key),
)
.route(
"/rpc/:rpc_key/",
get(rpc_proxy_ws::websocket_handler_with_key),
)
.route("/health", get(status::health))
.route("/user/login/:user_address", get(users::user_login_get))
.route(

@ -7,7 +7,6 @@ use super::{FrontendResponseCache, FrontendResponseCaches};
use crate::app::Web3ProxyApp;
use axum::{http::StatusCode, response::IntoResponse, Extension, Json};
use axum_macros::debug_handler;
use moka::future::ConcurrentCacheExt;
use serde_json::json;
use std::sync::Arc;