Skip to content

Commit c7cc24f

Browse files
chore: Add health endpoint
1 parent 50ec345 commit c7cc24f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

crates/rpc/src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use model::cluster::ClusterState;
33
use rocket::{http::Method, routes};
44
use rocket_cors::{AllowedOrigins, CorsOptions};
55
use routes::{
6-
add_player::add_player, cleanup::cleanup, head::head, heads::heads, new_game::new_game,
7-
sample_transactions::sample_transactions, stats::global_stats,
6+
add_player::add_player, cleanup::cleanup, head::head, heads::heads, health::health,
7+
new_game::new_game, sample_transactions::sample_transactions, stats::global_stats,
88
};
99
use serde::Deserialize;
1010

@@ -50,7 +50,8 @@ async fn main() -> Result<()> {
5050
add_player,
5151
cleanup,
5252
sample_transactions,
53-
global_stats
53+
global_stats,
54+
health
5455
],
5556
)
5657
.attach(cors.to_cors().unwrap())

crates/rpc/src/routes/health.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
use rocket::get;
2+
3+
#[get("/health")]
4+
pub async fn health() -> String {
5+
"OK".to_string()
6+
}

crates/rpc/src/routes/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pub mod add_player;
22
pub mod cleanup;
33
pub mod head;
44
pub mod heads;
5+
pub mod health;
56
pub mod new_game;
67
pub mod sample_transactions;
78
pub mod stats;

0 commit comments

Comments
 (0)