Split the code into files
This commit is contained in:
19
src/router.rs
Normal file
19
src/router.rs
Normal file
@ -0,0 +1,19 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user