-
Notifications
You must be signed in to change notification settings - Fork 49
feat: refactor routing to use a dedicated router file #763
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
base: main
Are you sure you want to change the base?
Conversation
Move functionality from `.tuono/main.rs` to `.tuono/router.rs` to allow users to override `main.rs`. Updated all related references, logic, and tests to use the new router file for route handling. Introduced a modular approach to improve maintainability and clarity in routing logic.
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.
Thanks for it! I pretty much like the approach. Please fix the broken pipelines
Looks like it was just extra imports - |
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.
Overall, looks good to me. Thanks
Just pushed another change that exposes the Router so that you can customize which layers are added. I realized that wasn't possible in the previous implementation. |
Renamed `has_main` to `has_custom_main` and refactored file reading logic for simplicity and consistency. Introduced new test cases for stateful and stateless router functions. Updated router version display and streamlined code for main and app state detection.
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.
Hey @aig787, please take a look at the failing pipelines
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.
Just a small comments to remove. LGTM thanks
crates/tuono/src/app.rs
Outdated
// let file = File::open(base_path.join("src/app.rs"))?; | ||
// let mut buf_reader = BufReader::new(file); | ||
// let mut contents = String::new(); | ||
// buf_reader.read_to_string(&mut contents)?; |
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.
Please remove leftovers
@Valerioageno I cleaned up the dead code and rebased, but now see these failures. I don't think they're from me? Could you confirm if they're expected or not? |
@aig787 pipelines fixed. Can you rebase? |
Move functionality from
.tuono/main.rs
to.tuono/router.rs
to allow users to overridemain.rs
. Updated all related references, logic, and tests to use the new router file for route handling. Introduced a modular approach to improve maintainability and clarity in routing logic.Checklist
Related issue
Fixes #762
Overview
Allow the user to override
main.rs
by moving core functionality into a new.tuono/router.rs
file. If no user suppliedmain.rs
file is found, one is created at.tuono/main.rs
with the contentand the user can override this by creating a
src/main.rs
with the contentsand updating
Cargo.toml
to use the overridden main file