-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
17 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
use axum::routing::{get, post}; | ||
use axum::Router; | ||
|
||
pub mod root; | ||
pub mod user; | ||
|
||
use app::state::AppState; | ||
use root::create_root_router; | ||
use user::create_user_router; | ||
use root::root_get; | ||
use user::{users_get, users_id_get, users_post}; | ||
|
||
pub fn create_router(state: AppState) -> Router { | ||
let root_router = Router::new().route("/", get(root_get)); | ||
let user_router = Router::new() | ||
.route("/", post(users_post).get(users_get)) | ||
.route("/:id", get(users_id_get)); | ||
|
||
Router::new() | ||
.nest("/users", create_user_router(state.clone())) | ||
.nest("/", create_root_router(state)) | ||
.nest("/", root_router) | ||
.nest("/users", user_router) | ||
.with_state(state) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters