Files
yugioh-inventory/src/server/constants/card_table.rs

19 lines
488 B
Rust

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()))
}