From ac4c60d6c964527542ddeb1c160d17b77f6462f9 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Fri, 20 May 2022 20:57:00 +0000 Subject: [PATCH] include state for status --- web3-proxy/src/frontend.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web3-proxy/src/frontend.rs b/web3-proxy/src/frontend.rs index 85618ade..40ef4e0c 100644 --- a/web3-proxy/src/frontend.rs +++ b/web3-proxy/src/frontend.rs @@ -30,12 +30,13 @@ pub async fn run(port: u16, proxy_app: Arc) -> anyhow::Result<()> .route("/status", get(status)) .layer(Extension(proxy_app)); + // 404 for any unknown routes let app = app.fallback(handler_404.into_service()); // run our app with hyper // `axum::Server` is a re-export of `hyper::Server` let addr = SocketAddr::from(([0, 0, 0, 0], port)); - tracing::debug!("listening on {}", addr); + tracing::info!("listening on port {}", addr); axum::Server::bind(&addr) .serve(app.into_make_service()) .await @@ -60,7 +61,7 @@ async fn proxy_web3_rpc( } /// Status page -async fn status() -> impl IntoResponse { +async fn status(state: Extension>) -> impl IntoResponse { (StatusCode::INTERNAL_SERVER_ERROR, "Hello, list_rpcs!") }