Function backend::get_players

source ·
pub(crate) async fn get_players() -> impl Responder
Expand description

Reads the save file and sends a json object with all the players to the caller.

How to use:

The request structure is the following: http://ip_address/players

The json file that’s replied back is structured like the following:

players:
    <PLAYER1_NAME>:
        name: "<PLAYER_NAME>"
        xpos: <XPOS>
        ypos: <YPOS>
        health: <HEALTH>
    <PLAYER2_NAME>:
        name: "<PLAYER2_NAME>"
        ...
    <PLAYER3_NAME>:
    ...