-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve filesystem routing and path management #56
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @Angelmmiguel! Nonblocking: I do wonder if we want to revisit visibility of certain structs/functions.
Great catch @ereslibre! I fixed the visibility of Thanks! |
I was thinking in this part for this specific patch: diff --git a/src/main.rs b/src/main.rs
index 7272f9f..403ae82 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -19,7 +19,7 @@ use actix_web::{
};
use clap::Parser;
use data::kv::KV;
-use router::Routes;
+use router::routes::Routes;
use runner::WasmOutput;
use std::io::{Error, ErrorKind};
use std::path::PathBuf;
diff --git a/src/router/mod.rs b/src/router/mod.rs
index 39679f8..9d0bed5 100644
--- a/src/router/mod.rs
+++ b/src/router/mod.rs
@@ -1,9 +1,6 @@
// Copyright 2022 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0
-pub mod files;
-pub mod route;
-pub mod routes;
-
-pub use route::Route;
-pub use routes::Routes;
+mod files;
+mod route;
+pub(super) mod routes; However, we could double check all |
Good point. The only required entity is |
b8a9d7c
to
2fae41a
Compare
I rebased the changes with |
Refactor the logic to load the app routes from the filesystem. Before, we were using functions instead of related struct implementations. The code was not clear and
structs
were taking mixed responsibilities. For example, we had a public function toretrieve_best_route
that takesRoutes
as a parameter. I converted this into aRoutes
's method directly.This is the list of changes I applied:
router
)Routes
andRoute
structs into separate filesstruct
implementations to avoid passing references around to provide a resultglob
library withwax
. This library provides a better support for glob patterns. For example,glob
doesn't support multiple options like*.{js,wasm}
main
entrypoint to use the new APIs. It didn't require many changes.It closes #3