20 lines
433 B
Rust
20 lines
433 B
Rust
|
|
use axum::routing::{get, post};
|
||
|
|
|
||
|
|
pub mod funcs;
|
||
|
|
pub mod game;
|
||
|
|
|
||
|
|
use crate::app_state::AppState;
|
||
|
|
|
||
|
|
pub fn router(state: AppState) -> axum::Router {
|
||
|
|
axum::Router::new()
|
||
|
|
.route(
|
||
|
|
"/api/games",
|
||
|
|
get(funcs::games_list).post(funcs::insert_game),
|
||
|
|
)
|
||
|
|
.route(
|
||
|
|
"/api/games/{id}",
|
||
|
|
post(funcs::insert_game).delete(funcs::delete_game),
|
||
|
|
)
|
||
|
|
.with_state(state)
|
||
|
|
}
|