Add card table loading
This commit is contained in:
18
src/server/constants/card_table.rs
Normal file
18
src/server/constants/card_table.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use std::path::Path;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use crate::server::server_state::ServerState;
|
||||
use axum::{debug_handler, extract::State, http::StatusCode, Json};
|
||||
|
||||
use crate::models::card::CardTable;
|
||||
|
||||
lazy_static! {
|
||||
static ref CARD_TABLE: CardTable =
|
||||
CardTable::new_from_server_json(Path::new("./data/cardinfo.json"));
|
||||
}
|
||||
|
||||
#[debug_handler]
|
||||
pub async fn get_card_table(State(_): State<ServerState>) -> Result<Json<CardTable>, StatusCode> {
|
||||
Ok(Json(CARD_TABLE.clone()))
|
||||
}
|
||||
Reference in New Issue
Block a user