This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(crate): Move handler to separate (sub)module
- Loading branch information
1 parent
f7a5020
commit 877cf3b
Showing
4 changed files
with
13 additions
and
5 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
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,12 +1,9 @@ | ||
// Copyright 2023 Naian G. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
use axum::{Router, routing::get}; | ||
use crate::routes::hello_world; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
pub fn create_router() -> Router { | ||
let app = Router::new().route("/", get(handle_get)); | ||
let app = Router::new().route("/", get(hello_world::handle_get)); | ||
return app; | ||
} | ||
|
||
async fn handle_get() -> String { | ||
"hey".to_owned() | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright 2023 Naian G. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pub async fn handle_get() -> String { | ||
"hey".to_owned() | ||
} |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright 2023 Naian G. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pub mod hello_world; | ||
This comment has been minimized.
Sorry, something went wrong.
nain-F49FF806
Author
Owner
|
hello_world
, a submodule of moduleroutes
is called here using its path from root crate