Skip to content

Commit

Permalink
Add health endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzejkop committed Dec 5, 2023
1 parent 4a0d9e1 commit 7766fa9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/fake-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ async fn rpc(
anvil.advance().await.unwrap();
}

anvil.reference_anvil.lock().await
anvil.main_anvil.lock().await
}
"eth_getTransactionReceipt" => anvil.main_anvil.lock().await,
"eth_getTransactionByHash" => anvil.reference_anvil.lock().await,
"eth_getTransactionByHash" => anvil.main_anvil.lock().await,
_ => anvil.main_anvil.lock().await,
};

Expand Down
1 change: 1 addition & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ pub async fn spawn_server(

let router = Router::new()
.nest("/1", v1_routes)
.route("/health", get(routes::health))
.layer(tower_http::trace::TraceLayer::new_for_http())
.layer(axum::middleware::from_fn(middleware::log_response));

Expand Down
6 changes: 6 additions & 0 deletions src/server/routes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
use hyper::StatusCode;

pub mod network;
pub mod relayer;
pub mod transaction;

pub async fn health() -> StatusCode {
StatusCode::OK
}

0 comments on commit 7766fa9

Please sign in to comment.