~starkingdoms/starkingdoms

ref: 2978ea95ca28f8c40a4cd8665bed3e327fee3d11 starkingdoms/api/src/routes/server_list.rs -rw-r--r-- 341 bytes
2978ea95 — c0repwn3r particle system 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::config::CONFIG;
use actix_web::get;
use actix_web::web::Json;
use serde::Serialize;

#[derive(Serialize)]
pub struct ServerListResponse {
    pub servers: Vec<String>,
}

#[get("server-list")]
pub async fn server_list() -> Json<ServerListResponse> {
    Json(ServerListResponse {
        servers: CONFIG.servers.clone(),
    })
}