Add a route to get default rules
This commit is contained in:
parent
6be3eae863
commit
83d0780954
@ -28,6 +28,11 @@ async fn game_configuration() -> impl Responder {
|
|||||||
HttpResponse::Ok().json(PlayConfiguration::default())
|
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)]
|
#[derive(serde::Serialize, serde::Deserialize, Eq, PartialEq, Debug)]
|
||||||
pub struct BotPlayQuery {
|
pub struct BotPlayQuery {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
@ -155,6 +160,7 @@ pub async fn start_server(args: Args) -> std::io::Result<()> {
|
|||||||
.wrap(cors)
|
.wrap(cors)
|
||||||
.route("/version", web::get().to(version_information))
|
.route("/version", web::get().to(version_information))
|
||||||
.route("/config", web::get().to(game_configuration))
|
.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/bot", web::get().to(start_bot_play))
|
||||||
.route("/play/create_invite", web::get().to(start_create_invite))
|
.route("/play/create_invite", web::get().to(start_create_invite))
|
||||||
.route("/play/accept_invite", web::get().to(start_accept_invite))
|
.route("/play/accept_invite", web::get().to(start_accept_invite))
|
||||||
|
Loading…
Reference in New Issue
Block a user