Skip to content

Commit

Permalink
Merge pull request #36 from EdwinBetanc0urt/feature/change-route-hier…
Browse files Browse the repository at this point in the history
…archy

feat: Change route hierarchy.
  • Loading branch information
yamelsenih authored Jun 10, 2024
2 parents 2325fcb + 26e5117 commit 8c5b400
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 53 deletions.
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,30 +107,31 @@ INFO [server] Server Address: "0.0.0.0:7878"
│ ├──[OPTIONS] -> server::get_menu
│ └──[GET] -> server::get_menu
└──dictionary
├──browsers/<id>
│ ├──[OPTIONS] -> server::get_browsers
│ └──[GET] -> server::get_browsers
├──browsers
│ ├──[OPTIONS] -> server::get_browsers
──[GET] -> server::get_browsers
├──forms/<id>
│ ├──[OPTIONS] -> server::get_forms
│ └──[GET] -> server::get_forms
│ ├──[OPTIONS] -> server::options_response
──[GET] -> server::get_browsers
│ └──<id>
├──[OPTIONS] -> server::options_response
└──[GET] -> server::get_browsers
├──forms
│ ├──[OPTIONS] -> server::get_forms
──[GET] -> server::get_forms
├──processes/<id>
│ ├──[OPTIONS] -> server::get_process
│ └──[GET] -> server::get_process
│ ├──[OPTIONS] -> server::options_response
──[GET] -> server::get_forms
│ └──<id>
├──[OPTIONS] -> server::options_response
└──[GET] -> server::get_forms
├──processes
│ ├──[OPTIONS] -> server::get_process
──[GET] -> server::get_process
├──windows/<id>
│ ├──[OPTIONS] -> server::get_windows
│ └──[GET] -> server::get_windows
│ ├──[OPTIONS] -> server::options_response
──[GET] -> server::get_processes
│ └──<id>
├──[OPTIONS] -> server::options_response
└──[GET] -> server::get_processes
└──windows
├──[OPTIONS] -> server::get_windows
└──[GET] -> server::get_windows
├──[OPTIONS] -> server::options_response
├──[GET] -> server::get_windows
└──<id>
├──[OPTIONS] -> server::options_response
└──[GET] -> server::get_windows

INFO [server] Kafka Consumer is enabled
INFO [server] Kafka queue: "0.0.0.0:29092"
INFO [server] Topics to Subscribed: ["menu", "browser", "form", "process", "window"]
Expand Down
66 changes: 33 additions & 33 deletions src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,58 +53,58 @@ async fn main() {
.options(options_response)
.get(get_menu)
)
.push(
// /api/dictionary
Router::with_path("dictionary")
.push(
// /api/dictionary/browsers/:id
Router::with_path("browsers/<id>")
.options(options_response)
.get(get_browsers)
)
.push(
// /api/dictionary
Router::with_path("dictionary")
.push(
// /api/dictionary/browsers/
Router::with_path("browsers")
.options(options_response)
.get(get_browsers)
)
.push(
// /api/dictionary/forms/:id
Router::with_path("forms/<id>")
.options(options_response)
.get(get_forms)
.push(
// /api/dictionary/browsers/:id
Router::with_path("<id>")
.options(options_response)
.get(get_browsers)
)
)
.push(
// /api/dictionary/forms/
Router::with_path("forms")
.options(options_response)
.get(get_forms)
.push(
// /api/dictionary/forms/:id
Router::with_path("<id>")
.options(options_response)
.get(get_forms)
)
)
.push(
// /api/dictionary/processes/:id
Router::with_path("processes/<id>")
// /api/dictionary/processes
Router::with_path("processes")
.options(options_response)
.get(get_process)
)
.push(
// /api/dictionary/processes
Router::with_path("processes")
.options(options_response)
.get(get_process)
)
.push(
// /api/dictionary/windows/:id
Router::with_path("windows/<id>")
.options(options_response)
.get(get_windows)
.get(get_processes)
.push(
// /api/dictionary/processes/:id
Router::with_path("<id>")
.options(options_response)
.get(get_processes)
)
)
.push(
// /api/dictionary/windows/
Router::with_path("windows")
.options(options_response)
.get(get_windows)
)
)
.push(
// /api/dictionary/windows/:id
Router::with_path("<id>")
.options(options_response)
.get(get_windows)
)
)
)
)
;
log::info!("{:#?}", router);
Expand Down Expand Up @@ -227,7 +227,7 @@ async fn get_menu<'a>(_req: &mut Request, _res: &mut Response) {
}

#[handler]
async fn get_process<'a>(_req: &mut Request, _res: &mut Response) {
async fn get_processes<'a>(_req: &mut Request, _res: &mut Response) {
let _id = _req.param::<i32>("id");
let _language = _req.queries().get("language");
let _client_id = _req.queries().get("client_id");
Expand Down

0 comments on commit 8c5b400

Please sign in to comment.