DioxusLabs / DioxusLabs/dioxus
Set base_path at runtime?
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
## Feature Request
It would be great if `base_path` could be set at runtime. People deploy at different sub-paths, and I want to distribute a single binary for all of them.
## Implement Suggestion
I suggest adding an argument to `router` function:
https://github.com/DioxusLabs/dioxus/blob/417bf7a4c17ed86ccf757d6b17abca0bf8a6028d/packages/fullstack-server/src/launch.rs#L96-L104
Like this:
```rust
pub fn router(app: fn() -> Element, base_path: Option) -> Router {
let cfg = ServeConfig::new();
apply_base_path(
Router::new().serve_dioxus_application(cfg.clone(), app),
app,
cfg,
base_path.unwrap_or(base_path().map(|s| s.to_string())),
)
}
```
But this might be too breaking, and impact many people who doesn't need base_path.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.