diff --git a/rust/sea_battle_backend/src/server.rs b/rust/sea_battle_backend/src/server.rs index a0e7e25..a255d8d 100644 --- a/rust/sea_battle_backend/src/server.rs +++ b/rust/sea_battle_backend/src/server.rs @@ -28,6 +28,11 @@ async fn game_configuration() -> impl Responder { HttpResponse::Ok().json(PlayConfiguration::default()) } +/// Get default game rules +async fn default_rules() -> impl Responder { + HttpResponse::Ok().json(GameRules::random_players_rules()) +} + #[derive(serde::Serialize, serde::Deserialize, Eq, PartialEq, Debug)] pub struct BotPlayQuery { #[serde(flatten)] @@ -155,6 +160,7 @@ pub async fn start_server(args: Args) -> std::io::Result<()> { .wrap(cors) .route("/version", web::get().to(version_information)) .route("/config", web::get().to(game_configuration)) + .route("/default_rules", web::get().to(default_rules)) .route("/play/bot", web::get().to(start_bot_play)) .route("/play/create_invite", web::get().to(start_create_invite)) .route("/play/accept_invite", web::get().to(start_accept_invite))