Skip to content

Commit e5ab210

Browse files
committed
Fix dioxus-fullstack config example code
1 parent 3e0ad8b commit e5ab210

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

packages/docs-router/src/doc_examples/guide_backend.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mod save_dog_launch {
5050
let router = axum::Router::new().serve_dioxus_application(config, app);
5151

5252
// start server
53-
let socket_addr = cli_config::fullstack_address_or_localhost();
53+
let socket_addr = dioxus::cli_config::fullstack_address_or_localhost();
5454
let listener = tokio::net::TcpListener::bind(socket_addr).await.unwrap();
5555
axum::serve(listener, router).await.unwrap();
5656
}
@@ -80,7 +80,7 @@ mod separate_server_launch {
8080
dioxus::logger::initialize_default();
8181

8282
// Connect to the IP and PORT env vars passed by the Dioxus CLI (or your dockerfile)
83-
let socket_addr = cli_config::fullstack_address_or_localhost();
83+
let socket_addr = dioxus::cli_config::fullstack_address_or_localhost();
8484

8585
// Build a custom axum router
8686
let router = axum::Router::new()

packages/docs-router/src/docs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ fn CodeBlock(contents: String, name: Option<String>) -> Element {
9393
}
9494
}
9595

96-
9796
pub(crate) static Copy: Component<()> = |_| {
9897
rsx!(
9998
svg {

packages/docsite/src/components/llms.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ pub fn generate_llms_txt() {
4040
let path = route_to_path(&route);
4141
_ = std::fs::create_dir_all(&path);
4242
let path = path.join("llms.txt");
43-
let file = std::fs::File::options().create(true).write(true).open(&path)?;
43+
let file = std::fs::File::options()
44+
.create(true)
45+
.write(true)
46+
.open(&path)?;
4447
let mut file = std::io::BufWriter::new(file);
4548
writeln!(file, "<SYSTEM>This is the developer documentation for Dioxus from {route}.</SYSTEM>\n{content}")?;
4649
file.write_all(content.as_bytes())?;

packages/include_mdbook/packages/mdbook-gen-example/src/router.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ impl BookRoute {
2525
1usize => {
2626
"# Roadmap & Feature-set\n\nThis feature set and roadmap can help you decide if what Dioxus can do today works for you.\n\nIf a feature that you need doesn't exist or you want to contribute to projects on the roadmap, feel free to get involved by [joining the discord](https://discord.gg/XgGxMSkvUM).\n\nGenerally, here's the status of each platform:\n\n* **Web**: Dioxus is a great choice for pure web-apps – especially for CRUD/complex apps. However, it does lack the ecosystem of React, so you might be missing a component library or some useful hook.\n\n* **SSR**: Dioxus is a great choice for pre-rendering, hydration, and rendering HTML on a web endpoint. Be warned – the VirtualDom is not (currently) `Send + Sync`.\n\n* **Desktop**: You can build very competent single-window desktop apps right now. However, multi-window apps require support from Dioxus core and are not ready.\n\n* **Mobile**: Mobile support is very young. You'll be figuring things out as you go and there are not many support crates for peripherals.\n\n* **LiveView**: LiveView support is very young. You'll be figuring things out as you go. Thankfully, none of it is too hard and any work can be upstreamed into Dioxus.\n\n````rust\nfn main() {\n dioxus_rocks;\n}\n````\n\n## Features\n\n---\n\n|Feature|Status|Description|\n|-------|------|-----------|\n|Conditional Rendering|✅|if/then to hide/show component|\n|Map, Iterator|✅|map/filter/reduce to produce rsx!|\n|Keyed Components|✅|advanced diffing with keys|\n|Web|✅|renderer for web browser|\n|Desktop (webview)|✅|renderer for desktop|\n|Shared State (Context)|✅|share state through the tree|\n|Hooks|✅|memory cells in components|\n|SSR|✅|render directly to string|\n|Component Children|✅|cx.children() as a list of nodes|\n|Headless components|✅|components that don't return real elements|\n|Fragments|✅|multiple elements without a real root|\n|Manual Props|✅|Manually pass in props with spread syntax|\n|Controlled Inputs|✅|stateful wrappers around inputs|\n|CSS/Inline Styles|✅|syntax for inline styles/attribute groups|\n|Custom elements|✅|Define new element primitives|\n|Suspense|✅|schedule future render from future/promise|\n|Integrated error handling|✅|Gracefully handle errors with ? syntax|\n|NodeRef|✅|gain direct access to nodes|\n|Re-hydration|✅|Pre-render to HTML to speed up first contentful paint|\n|Jank-Free Rendering|✅|Large diffs are segmented across frames for silky-smooth transitions|\n|Effects|✅|Run effects after a component has been committed to render|\n|Portals|🛠|Render nodes outside of the traditional tree structure|\n|Cooperative Scheduling|🛠|Prioritize important events over non-important events|\n|Server Components|🛠|Hybrid components for SPA and Server|\n|Bundle Splitting|👀|Efficiently and asynchronously load the app|\n|Lazy Components|👀|Dynamically load the new components as the page is loaded|\n|1st class global state|✅|redux/recoil/mobx on top of context|\n|Runs natively|✅|runs as a portable binary w/o a runtime (Node)|\n|Subtree Memoization|✅|skip diffing static element subtrees|\n|High-efficiency templates|✅|rsx! calls are translated to templates on the DOM's side|\n|Compile-time correct|✅|Throw errors on invalid template layouts|\n|Heuristic Engine|✅|track component memory usage to minimize future allocations|\n|Fine-grained reactivity|👀|Skip diffing for fine-grain updates|\n\n* ✅ = implemented and working\n* 🛠 = actively being worked on\n* 👀 = not yet implemented or being worked on\n\n## Roadmap\n\nThese Features are planned for the future of Dioxus:\n\n### Core\n\n* [x] Release of Dioxus Core\n* [x] Upgrade documentation to include more theory and be more comprehensive\n* [x] Support for HTML-side templates for lightning-fast dom manipulation\n* [ ] Support for multiple renderers for same virtualdom (subtrees)\n* [ ] Support for ThreadSafe (Send + Sync)\n* [ ] Support for Portals\n\n### SSR\n\n* [x] SSR Support + Hydration\n* [ ] Integrated suspense support for SSR\n\n### Desktop\n\n* [ ] Declarative window management\n* [ ] Templates for building/bundling\n* [ ] Access to Canvas/WebGL context natively\n\n### Mobile\n\n* [ ] Mobile standard library\n * [ ] GPS\n * [ ] Camera\n * [ ] filesystem\n * [ ] Biometrics\n * [ ] WiFi\n * [ ] Bluetooth\n * [ ] Notifications\n * [ ] Clipboard\n* [ ] Animations\n\n### Bundling (CLI)\n\n* [x] Translation from HTML into RSX\n* [x] Dev server\n* [x] Live reload\n* [x] Translation from JSX into RSX\n* [ ] Hot module replacement\n* [ ] Code splitting\n* [ ] Asset macros\n* [ ] Css pipeline\n* [ ] Image pipeline\n\n### Essential hooks\n\n* [x] Router\n* [x] Global state management\n* [ ] Resize observer\n\n## Work in Progress\n\n### Build Tool\n\nWe are currently working on our own build tool called [Dioxus CLI](https://github.com/DioxusLabs/dioxus/tree/master/packages/cli) which will support:\n\n* an interactive TUI\n* on-the-fly reconfiguration\n* hot CSS reloading\n* two-way data binding between browser and source code\n* an interpreter for `rsx!`\n* ability to publish to github/netlify/vercel\n* bundling for iOS/Desktop/etc\n\n### Server Component Support\n\nWhile not currently fully implemented, the expectation is that LiveView apps can be a hybrid between Wasm and server-rendered where only portions of a page are \"live\" and the rest of the page is either server-rendered, statically generated, or handled by the host SPA.\n\n### Native rendering\n\nWe are currently working on a native renderer for Dioxus using WGPU called [Blitz](https://github.com/DioxusLabs/blitz/). This will allow you to build apps that are rendered natively for iOS, Android, and Desktop.\n\n## Internal Links\n\nInternal links like [this](./chapter_1.md) are typechecked and will fail to compile if the file is not found."
2727
}
28-
0usize => {
29-
"# Liveview\n\nLiveview allows apps to *run* on the server and *render* in the browser. It uses WebSockets to communicate between the server and the browser.\n\nExamples:\n\n* [Axum Example](https://github.com/DioxusLabs/dioxus/tree/master/packages/liveview/examples/axum.rs)\n* [Salvo Example](https://github.com/DioxusLabs/dioxus/tree/master/packages/liveview/examples/salvo.rs)\n* [Warp Example](https://github.com/DioxusLabs/dioxus/tree/master/packages/liveview/examples/warp.rs)\n\n## Support\n\nLiveview is currently limited in capability when compared to the Web platform. Liveview apps run on the server in a native thread. This means that browser APIs are not available, so rendering WebGL, Canvas, etc is not as easy as the Web. However, native system APIs are accessible, so streaming, WebSockets, filesystem, etc are all viable APIs.\n\n## Setup\n\nFor this guide, we're going to show how to use Dioxus Liveview with [Axum](https://docs.rs/axum/latest/axum/).\n\nMake sure you have Rust and Cargo installed, and then create a new project:\n\n````shell\ncargo new --bin demo\ncd app\n````\n\nAdd Dioxus and the liveview renderer with the Axum feature as dependencies:\n\n````shell\ncargo add dioxus\ncargo add dioxus-liveview --features axum\n````\n\nNext, add all the Axum dependencies. This will be different if you're using a different Web Framework\n\n````\ncargo add tokio --features full\ncargo add axum\n````\n\nYour dependencies should look roughly like this:\n\n````toml\n[dependencies]\naxum = \"0.4.5\"\ndioxus = { version = \"*\" }\ndioxus-liveview = { version = \"*\", features = [\"axum\"] }\ntokio = { version = \"1.15.0\", features = [\"full\"] }\n````\n\n````rust@included_example.rs\nfn it_works() {}\n\n````\n\n````sh\n{\"timestamp\":\" 9.927s\",\"level\":\"INFO\",\"message\":\"Bundled app successfully!\",\"target\":\"dx::cli::bundle\"}\n{\"timestamp\":\" 9.927s\",\"level\":\"INFO\",\"message\":\"App produced 2 outputs:\",\"target\":\"dx::cli::bundle\"}\n{\"timestamp\":\" 9.927s\",\"level\":\"INFO\",\"message\":\"app - [target/dx/hot_dog/bundle/macos/bundle/macos/HotDog.app]\",\"target\":\"dx::cli::bundle\"}\n{\"timestamp\":\" 9.927s\",\"level\":\"INFO\",\"message\":\"dmg - [target/dx/hot_dog/bundle/macos/bundle/dmg/HotDog_0.1.0_aarch64.dmg]\",\"target\":\"dx::cli::bundle\"}\n{\"timestamp\":\" 9.927s\",\"level\":\"DEBUG\",\"json\":\"{\\\"BundleOutput\\\":{\\\"bundles\\\":[\\\"target/dx/hot_dog/bundle/macos/bundle/macos/HotDog.app\\\"]}}\"}\n````"
30-
}
3128
2usize => {
3229
"# Assets\n\nSome assets:\n![some_external](https://avatars.githubusercontent.com/u/79236386?s=200&v=4)\n![some_local](/example-book/assets/logo.png)\n![some_local1](/example-book/assets/logo1.png)\n![some_local2](/example-book/assets/logo2.png)"
3330
}
31+
0usize => {
32+
"# Liveview\n\nLiveview allows apps to *run* on the server and *render* in the browser. It uses WebSockets to communicate between the server and the browser.\n\nExamples:\n\n* [Axum Example](https://github.com/DioxusLabs/dioxus/tree/master/packages/liveview/examples/axum.rs)\n* [Salvo Example](https://github.com/DioxusLabs/dioxus/tree/master/packages/liveview/examples/salvo.rs)\n* [Warp Example](https://github.com/DioxusLabs/dioxus/tree/master/packages/liveview/examples/warp.rs)\n\n## Support\n\nLiveview is currently limited in capability when compared to the Web platform. Liveview apps run on the server in a native thread. This means that browser APIs are not available, so rendering WebGL, Canvas, etc is not as easy as the Web. However, native system APIs are accessible, so streaming, WebSockets, filesystem, etc are all viable APIs.\n\n## Setup\n\nFor this guide, we're going to show how to use Dioxus Liveview with [Axum](https://docs.rs/axum/latest/axum/).\n\nMake sure you have Rust and Cargo installed, and then create a new project:\n\n````shell\ncargo new --bin demo\ncd app\n````\n\nAdd Dioxus and the liveview renderer with the Axum feature as dependencies:\n\n````shell\ncargo add dioxus\ncargo add dioxus-liveview --features axum\n````\n\nNext, add all the Axum dependencies. This will be different if you're using a different Web Framework\n\n````\ncargo add tokio --features full\ncargo add axum\n````\n\nYour dependencies should look roughly like this:\n\n````toml\n[dependencies]\naxum = \"0.4.5\"\ndioxus = { version = \"*\" }\ndioxus-liveview = { version = \"*\", features = [\"axum\"] }\ntokio = { version = \"1.15.0\", features = [\"full\"] }\n````\n\n````rust@included_example.rs\nfn it_works() {}\n\n````\n\n````sh\n{\"timestamp\":\" 9.927s\",\"level\":\"INFO\",\"message\":\"Bundled app successfully!\",\"target\":\"dx::cli::bundle\"}\n{\"timestamp\":\" 9.927s\",\"level\":\"INFO\",\"message\":\"App produced 2 outputs:\",\"target\":\"dx::cli::bundle\"}\n{\"timestamp\":\" 9.927s\",\"level\":\"INFO\",\"message\":\"app - [target/dx/hot_dog/bundle/macos/bundle/macos/HotDog.app]\",\"target\":\"dx::cli::bundle\"}\n{\"timestamp\":\" 9.927s\",\"level\":\"INFO\",\"message\":\"dmg - [target/dx/hot_dog/bundle/macos/bundle/dmg/HotDog_0.1.0_aarch64.dmg]\",\"target\":\"dx::cli::bundle\"}\n{\"timestamp\":\" 9.927s\",\"level\":\"DEBUG\",\"json\":\"{\\\"BundleOutput\\\":{\\\"bundles\\\":[\\\"target/dx/hot_dog/bundle/macos/bundle/macos/HotDog.app\\\"]}}\"}\n````"
33+
}
3434
_ => panic!("Invalid page ID:"),
3535
}
3636
}

0 commit comments

Comments
 (0)