diff --git a/Cargo.toml b/Cargo.toml index a5beb4aeb..f6be8e745 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,13 +22,13 @@ members = [ "packages/rsx-rosetta", "packages/signals", "packages/hot-reload", - "packages/server", - "packages/server/server-macro", - "packages/server/examples/axum-hello-world", - "packages/server/examples/axum-router", - "packages/server/examples/axum-desktop", - "packages/server/examples/salvo-hello-world", - "packages/server/examples/warp-hello-world", + "packages/fullstack", + "packages/fullstack/server-macro", + "packages/fullstack/examples/axum-hello-world", + "packages/fullstack/examples/axum-router", + "packages/fullstack/examples/axum-desktop", + "packages/fullstack/examples/salvo-hello-world", + "packages/fullstack/examples/warp-hello-world", "docs/guide", ] diff --git a/docs/guide/Cargo.toml b/docs/guide/Cargo.toml index 00a5c7543..b5b53b0b3 100644 --- a/docs/guide/Cargo.toml +++ b/docs/guide/Cargo.toml @@ -16,7 +16,7 @@ dioxus-native-core-macro = { path = "../../packages/native-core-macro" } dioxus-router = { path = "../../packages/router" } dioxus-liveview = { path = "../../packages/liveview", features = ["axum"] } dioxus-tui = { path = "../../packages/dioxus-tui" } -dioxus-server = { path = "../../packages/server" } +dioxus-fullstack = { path = "../../packages/fullstack" } fermi = { path = "../../packages/fermi" } shipyard = "0.6.2" diff --git a/docs/guide/examples/hydration.rs b/docs/guide/examples/hydration.rs index f3c9bca8f..31574edce 100644 --- a/docs/guide/examples/hydration.rs +++ b/docs/guide/examples/hydration.rs @@ -6,7 +6,7 @@ fn main() { dioxus_web::launch_cfg(app, dioxus_web::Config::new().hydrate(true)); #[cfg(feature = "ssr")] { - use dioxus_server::prelude::*; + use dioxus_fullstack::prelude::*; tokio::runtime::Runtime::new() .unwrap() .block_on(async move { diff --git a/docs/guide/examples/server_basic.rs b/docs/guide/examples/server_basic.rs index bd6cf78e6..858fcfd50 100644 --- a/docs/guide/examples/server_basic.rs +++ b/docs/guide/examples/server_basic.rs @@ -5,7 +5,7 @@ use dioxus::prelude::*; async fn main() { #[cfg(feature = "ssr")] { - use dioxus_server::prelude::*; + use dioxus_fullstack::prelude::*; let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 8080)); axum::Server::bind(&addr) diff --git a/docs/guide/examples/server_function.rs b/docs/guide/examples/server_function.rs index 106c54c3f..4a0c9d584 100644 --- a/docs/guide/examples/server_function.rs +++ b/docs/guide/examples/server_function.rs @@ -1,6 +1,6 @@ #![allow(non_snake_case, unused)] use dioxus::prelude::*; -use dioxus_server::prelude::*; +use dioxus_fullstack::prelude::*; fn main() { #[cfg(feature = "web")] diff --git a/docs/guide/src/en/getting_started/fullstack.md b/docs/guide/src/en/getting_started/fullstack.md index f01d8dd30..acaaefbb9 100644 --- a/docs/guide/src/en/getting_started/fullstack.md +++ b/docs/guide/src/en/getting_started/fullstack.md @@ -4,11 +4,11 @@ We can combine the `dioxus-web` renderer with the `dioxus-ssr` renderer to create a full-stack Dioxus application. By combining server-side rendering with client-side hydration we can create an application that is initially rendered on the server and then hydrates the application on the client. Server-side rendering results in a fast first paint and make our page SEO-friendly. Client-side hydration makes our page responsive once the application has fully loaded. -To help make full-stack development easier, Dioxus provides a `dioxus-server` crate that integrates with popular web frameworks with utilities for full-stack development. +To help make full-stack development easier, Dioxus provides a `dioxus-fullstack` crate that integrates with popular web frameworks with utilities for full-stack development. ## Setup -For this guide, we're going to show how to use Dioxus with [Axum](https://docs.rs/axum/latest/axum/), but `dioxus-server` also integrates with the [Warp](https://docs.rs/warp/latest/warp/) and [Salvo](https://docs.rs/salvo/latest/salvo/) web frameworks. +For this guide, we're going to show how to use Dioxus with [Axum](https://docs.rs/axum/latest/axum/), but `dioxus-fullstack` also integrates with the [Warp](https://docs.rs/warp/latest/warp/) and [Salvo](https://docs.rs/salvo/latest/salvo/) web frameworks. Make sure you have Rust and Cargo installed, and then create a new project: @@ -17,11 +17,11 @@ cargo new --bin demo cd demo ``` -Add `dioxus` and `dioxus-server` as dependencies: +Add `dioxus` and `dioxus-fullstack` as dependencies: ```shell cargo add dioxus -cargo add dioxus-server --features axum, ssr +cargo add dioxus-fullstack --features axum, ssr ``` Next, add all the Axum dependencies. This will be different if you're using a different Web Framework @@ -37,7 +37,7 @@ Your dependencies should look roughly like this: [dependencies] axum = "*" dioxus = { version = "*" } -dioxus-server = { version = "*", features = ["axum", "ssr"] } +dioxus-fullstack = { version = "*", features = ["axum", "ssr"] } tokio = { version = "*", features = ["full"] } ``` @@ -59,7 +59,7 @@ First, modify your `Cargo.toml` to include two features, one for the server call [dependencies] # Common dependancies dioxus = { version = "*" } -dioxus-server = { version = "*" } +dioxus-fullstack = { version = "*" } # Web dependancies dioxus-web = { version = "*", features=["hydrate"], optional = true } @@ -70,7 +70,7 @@ tokio = { version = "1.27.0", features = ["full"], optional = true } [features] default = [] -ssr = ["axum", "tokio", "dioxus-server/axum"] +ssr = ["axum", "tokio", "dioxus-fullstack/axum"] web = ["dioxus-web"] ``` @@ -112,4 +112,4 @@ Now, build your client-side bundle with `dioxus build --features web` and run yo ## Conclusion -That's it! You've created a full-stack Dioxus app. You can find more examples of full-stack apps and information about how to integrate with other frameworks and desktop renderers in the [dioxus-server examples directory](https://github.com/DioxusLabs/dioxus/tree/master/packages/server/examples). +That's it! You've created a full-stack Dioxus app. You can find more examples of full-stack apps and information about how to integrate with other frameworks and desktop renderers in the [dioxus-fullstack examples directory](https://github.com/DioxusLabs/dioxus/tree/master/packages/server/examples). diff --git a/packages/server/.gitignore b/packages/fullstack/.gitignore similarity index 100% rename from packages/server/.gitignore rename to packages/fullstack/.gitignore diff --git a/packages/server/Cargo.toml b/packages/fullstack/Cargo.toml similarity index 98% rename from packages/server/Cargo.toml rename to packages/fullstack/Cargo.toml index 753d4c2cb..581bf2f52 100644 --- a/packages/server/Cargo.toml +++ b/packages/fullstack/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "dioxus-server" +name = "dioxus-fullstack" version = "0.1.0" edition = "2021" description = "Fullstack Dioxus Utilities" diff --git a/packages/server/README.md b/packages/fullstack/README.md similarity index 73% rename from packages/server/README.md rename to packages/fullstack/README.md index 92f878684..ec3d1c833 100644 --- a/packages/server/README.md +++ b/packages/fullstack/README.md @@ -1,12 +1,12 @@ -# Dioxus Server +# Dioxus Fullstack [![Crates.io][crates-badge]][crates-url] [![MIT licensed][mit-badge]][mit-url] [![Build Status][actions-badge]][actions-url] [![Discord chat][discord-badge]][discord-url] -[crates-badge]: https://img.shields.io/crates/v/dioxus-server.svg -[crates-url]: https://crates.io/crates/dioxus-server +[crates-badge]: https://img.shields.io/crates/v/dioxus-fullstack.svg +[crates-url]: https://crates.io/crates/dioxus-fullstack [mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg [mit-url]: https://github.com/dioxuslabs/dioxus/blob/master/LICENSE [actions-badge]: https://github.com/dioxuslabs/dioxus/actions/workflows/main.yml/badge.svg @@ -16,16 +16,17 @@ [Website](https://dioxuslabs.com) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) | -[API Docs](https://docs.rs/dioxus-server/latest/dioxus_sever) | +[API Docs](https://docs.rs/dioxus-fullstack/latest/dioxus_sever) | [Chat](https://discord.gg/XgGxMSkvUM) Fullstack utilities for the [`Dioxus`](https://dioxuslabs.com) framework. # Features -- Intigrations with the [Axum](https::/docs.rs/dioxus-server/latest/dixous_server/axum_adapter/index.html), [Salvo](https::/docs.rs/dioxus-server/latest/dixous_server/salvo_adapter/index.html), and [Warp](https::/docs.rs/dioxus-server/latest/dixous_server/warp_adapter/index.html) server frameworks with utilities for serving and rendering Dioxus applications. -- [Server functions](https::/docs.rs/dioxus-server/latest/dixous_server/prelude/attr.server.html) allow you to call code on the server from the client as if it were a normal function. +- Intigrations with the [Axum](https::/docs.rs/dioxus-fullstack/latest/dixous_server/axum_adapter/index.html), [Salvo](https::/docs.rs/dioxus-fullstack/latest/dixous_server/salvo_adapter/index.html), and [Warp](https::/docs.rs/dioxus-fullstack/latest/dixous_server/warp_adapter/index.html) server frameworks with utilities for serving and rendering Dioxus applications. +- [Server functions](https::/docs.rs/dioxus-fullstack/latest/dixous_server/prelude/attr.server.html) allow you to call code on the server from the client as if it were a normal function. - Instant RSX Hot reloading with [`dioxus-hot-reload`](https://crates.io/crates/dioxus-hot-reload). +- Passing root props from the server to the client. # Example @@ -34,11 +35,15 @@ Full stack Dioxus in under 50 lines of code ```rust #![allow(non_snake_case)] use dioxus::prelude::*; -use dioxus_server::prelude::*; +use dioxus_fullstack::prelude::*; fn main() { #[cfg(feature = "web")] - dioxus_web::launch_cfg(app, dioxus_web::Config::new().hydrate(true)); + dioxus_web::launch_with_props( + app, + get_root_props_from_document().unwrap_or_default(), + dioxus_web::Config::new().hydrate(true), + ); #[cfg(feature = "ssr")] { GetMeaning::register().unwrap(); @@ -85,7 +90,7 @@ async fn get_meaning(of: String) -> Result, ServerFnError> { ## Getting Started -To get started with full stack Dioxus, check out our [getting started guide](https://dioxuslabs.com/docs/nightly/guide/en/getting_started/ssr.html), or the [full stack examples](https://github.com/DioxusLabs/dioxus/tree/master/packages/server/examples). +To get started with full stack Dioxus, check out our [getting started guide](https://dioxuslabs.com/docs/nightly/guide/en/getting_started/ssr.html), or the [full stack examples](https://github.com/DioxusLabs/dioxus/tree/master/packages/fullstack/examples). ## Contributing diff --git a/packages/server/examples/axum-desktop/.gitignore b/packages/fullstack/examples/axum-desktop/.gitignore similarity index 100% rename from packages/server/examples/axum-desktop/.gitignore rename to packages/fullstack/examples/axum-desktop/.gitignore diff --git a/packages/server/examples/axum-desktop/Cargo.toml b/packages/fullstack/examples/axum-desktop/Cargo.toml similarity index 83% rename from packages/server/examples/axum-desktop/Cargo.toml rename to packages/fullstack/examples/axum-desktop/Cargo.toml index 817202bd1..fefc3c7db 100644 --- a/packages/server/examples/axum-desktop/Cargo.toml +++ b/packages/fullstack/examples/axum-desktop/Cargo.toml @@ -10,14 +10,14 @@ publish = false dioxus-desktop = { path = "../../../desktop", optional = true } dioxus = { path = "../../../dioxus" } dioxus-router = { path = "../../../router" } -dioxus-server = { path = "../../" } +dioxus-fullstack = { path = "../../" } axum = { version = "0.6.12", optional = true } tokio = { version = "1.27.0", features = ["full"], optional = true } serde = "1.0.159" [features] default = [] -ssr = ["axum", "tokio", "dioxus-server/axum"] +ssr = ["axum", "tokio", "dioxus-fullstack/axum"] desktop = ["dioxus-desktop"] [[bin]] @@ -27,5 +27,5 @@ required-features = ["desktop"] [[bin]] name = "server" -path = "src/server.rs" +path = "src/fullstack.rs" required-features = ["ssr"] diff --git a/packages/server/examples/axum-desktop/src/client.rs b/packages/fullstack/examples/axum-desktop/src/client.rs similarity index 81% rename from packages/server/examples/axum-desktop/src/client.rs rename to packages/fullstack/examples/axum-desktop/src/client.rs index 588cf2003..8cb5b6cff 100644 --- a/packages/server/examples/axum-desktop/src/client.rs +++ b/packages/fullstack/examples/axum-desktop/src/client.rs @@ -4,7 +4,7 @@ // ``` use axum_desktop::*; -use dioxus_server::prelude::server_fn::set_server_url; +use dioxus_fullstack::prelude::server_fn::set_server_url; fn main() { // Set the url of the server where server functions are hosted. diff --git a/packages/server/examples/axum-desktop/src/lib.rs b/packages/fullstack/examples/axum-desktop/src/lib.rs similarity index 97% rename from packages/server/examples/axum-desktop/src/lib.rs rename to packages/fullstack/examples/axum-desktop/src/lib.rs index 3bae1dcde..1ac655ce1 100644 --- a/packages/server/examples/axum-desktop/src/lib.rs +++ b/packages/fullstack/examples/axum-desktop/src/lib.rs @@ -1,6 +1,6 @@ #![allow(non_snake_case)] use dioxus::prelude::*; -use dioxus_server::prelude::*; +use dioxus_fullstack::prelude::*; pub fn app(cx: Scope) -> Element { let mut count = use_state(cx, || 0); diff --git a/packages/server/examples/axum-desktop/src/server.rs b/packages/fullstack/examples/axum-desktop/src/server.rs similarity index 93% rename from packages/server/examples/axum-desktop/src/server.rs rename to packages/fullstack/examples/axum-desktop/src/server.rs index ff607dbcd..7602d1e48 100644 --- a/packages/server/examples/axum-desktop/src/server.rs +++ b/packages/fullstack/examples/axum-desktop/src/server.rs @@ -4,7 +4,7 @@ // ``` use axum_desktop::*; -use dioxus_server::prelude::*; +use dioxus_fullstack::prelude::*; #[tokio::main] async fn main() { diff --git a/packages/server/examples/axum-hello-world/.gitignore b/packages/fullstack/examples/axum-hello-world/.gitignore similarity index 100% rename from packages/server/examples/axum-hello-world/.gitignore rename to packages/fullstack/examples/axum-hello-world/.gitignore diff --git a/packages/server/examples/axum-hello-world/Cargo.toml b/packages/fullstack/examples/axum-hello-world/Cargo.toml similarity index 85% rename from packages/server/examples/axum-hello-world/Cargo.toml rename to packages/fullstack/examples/axum-hello-world/Cargo.toml index 27c6af08b..c1926b289 100644 --- a/packages/server/examples/axum-hello-world/Cargo.toml +++ b/packages/fullstack/examples/axum-hello-world/Cargo.toml @@ -9,7 +9,7 @@ publish = false [dependencies] dioxus-web = { path = "../../../web", features=["hydrate"], optional = true } dioxus = { path = "../../../dioxus" } -dioxus-server = { path = "../../" } +dioxus-fullstack = { path = "../../" } axum = { version = "0.6.12", optional = true } tokio = { version = "1.27.0", features = ["full"], optional = true } serde = "1.0.159" @@ -17,5 +17,5 @@ execute = "0.2.12" [features] default = ["web"] -ssr = ["axum", "tokio", "dioxus-server/axum"] +ssr = ["axum", "tokio", "dioxus-fullstack/axum"] web = ["dioxus-web"] diff --git a/packages/server/examples/axum-hello-world/src/main.rs b/packages/fullstack/examples/axum-hello-world/src/main.rs similarity index 98% rename from packages/server/examples/axum-hello-world/src/main.rs rename to packages/fullstack/examples/axum-hello-world/src/main.rs index 3db117c02..81768d3ad 100644 --- a/packages/server/examples/axum-hello-world/src/main.rs +++ b/packages/fullstack/examples/axum-hello-world/src/main.rs @@ -7,7 +7,7 @@ #![allow(non_snake_case)] use dioxus::prelude::*; -use dioxus_server::prelude::*; +use dioxus_fullstack::prelude::*; use serde::{Deserialize, Serialize}; fn main() { diff --git a/packages/server/examples/axum-router/.gitignore b/packages/fullstack/examples/axum-router/.gitignore similarity index 100% rename from packages/server/examples/axum-router/.gitignore rename to packages/fullstack/examples/axum-router/.gitignore diff --git a/packages/server/examples/axum-router/Cargo.toml b/packages/fullstack/examples/axum-router/Cargo.toml similarity index 86% rename from packages/server/examples/axum-router/Cargo.toml rename to packages/fullstack/examples/axum-router/Cargo.toml index 2ba621c9c..db4138430 100644 --- a/packages/server/examples/axum-router/Cargo.toml +++ b/packages/fullstack/examples/axum-router/Cargo.toml @@ -10,7 +10,7 @@ publish = false dioxus-web = { path = "../../../web", features=["hydrate"], optional = true } dioxus = { path = "../../../dioxus" } dioxus-router = { path = "../../../router" } -dioxus-server = { path = "../../" } +dioxus-fullstack = { path = "../../" } axum = { version = "0.6.12", optional = true } tokio = { version = "1.27.0", features = ["full"], optional = true } serde = "1.0.159" @@ -20,5 +20,5 @@ execute = "0.2.12" [features] default = ["web"] -ssr = ["axum", "tokio", "dioxus-server/axum", "tower-http", "http"] +ssr = ["axum", "tokio", "dioxus-fullstack/axum", "tower-http", "http"] web = ["dioxus-web", "dioxus-router/web"] diff --git a/packages/server/examples/axum-router/src/main.rs b/packages/fullstack/examples/axum-router/src/main.rs similarity index 99% rename from packages/server/examples/axum-router/src/main.rs rename to packages/fullstack/examples/axum-router/src/main.rs index 692bc91af..83c0fac58 100644 --- a/packages/server/examples/axum-router/src/main.rs +++ b/packages/fullstack/examples/axum-router/src/main.rs @@ -7,8 +7,8 @@ #![allow(non_snake_case)] use dioxus::prelude::*; +use dioxus_fullstack::prelude::*; use dioxus_router::*; -use dioxus_server::prelude::*; use serde::{Deserialize, Serialize}; fn main() { diff --git a/packages/server/examples/salvo-hello-world/.gitignore b/packages/fullstack/examples/salvo-hello-world/.gitignore similarity index 100% rename from packages/server/examples/salvo-hello-world/.gitignore rename to packages/fullstack/examples/salvo-hello-world/.gitignore diff --git a/packages/server/examples/salvo-hello-world/Cargo.toml b/packages/fullstack/examples/salvo-hello-world/Cargo.toml similarity index 85% rename from packages/server/examples/salvo-hello-world/Cargo.toml rename to packages/fullstack/examples/salvo-hello-world/Cargo.toml index 50c92f237..27b7e73dc 100644 --- a/packages/server/examples/salvo-hello-world/Cargo.toml +++ b/packages/fullstack/examples/salvo-hello-world/Cargo.toml @@ -9,7 +9,7 @@ publish = false [dependencies] dioxus-web = { path = "../../../web", features=["hydrate"], optional = true } dioxus = { path = "../../../dioxus" } -dioxus-server = { path = "../../" } +dioxus-fullstack = { path = "../../" } tokio = { version = "1.27.0", features = ["full"], optional = true } serde = "1.0.159" salvo = { version = "0.37.9", optional = true } @@ -17,5 +17,5 @@ execute = "0.2.12" [features] default = ["web"] -ssr = ["salvo", "tokio", "dioxus-server/salvo"] +ssr = ["salvo", "tokio", "dioxus-fullstack/salvo"] web = ["dioxus-web"] diff --git a/packages/server/examples/salvo-hello-world/src/main.rs b/packages/fullstack/examples/salvo-hello-world/src/main.rs similarity index 98% rename from packages/server/examples/salvo-hello-world/src/main.rs rename to packages/fullstack/examples/salvo-hello-world/src/main.rs index 25ebbbff9..fcfc5e95e 100644 --- a/packages/server/examples/salvo-hello-world/src/main.rs +++ b/packages/fullstack/examples/salvo-hello-world/src/main.rs @@ -7,7 +7,7 @@ #![allow(non_snake_case)] use dioxus::prelude::*; -use dioxus_server::prelude::*; +use dioxus_fullstack::prelude::*; use serde::{Deserialize, Serialize}; fn main() { diff --git a/packages/server/examples/warp-hello-world/.gitignore b/packages/fullstack/examples/warp-hello-world/.gitignore similarity index 100% rename from packages/server/examples/warp-hello-world/.gitignore rename to packages/fullstack/examples/warp-hello-world/.gitignore diff --git a/packages/server/examples/warp-hello-world/Cargo.toml b/packages/fullstack/examples/warp-hello-world/Cargo.toml similarity index 85% rename from packages/server/examples/warp-hello-world/Cargo.toml rename to packages/fullstack/examples/warp-hello-world/Cargo.toml index 2c5d175ae..18da0b249 100644 --- a/packages/server/examples/warp-hello-world/Cargo.toml +++ b/packages/fullstack/examples/warp-hello-world/Cargo.toml @@ -9,7 +9,7 @@ publish = false [dependencies] dioxus-web = { path = "../../../web", features=["hydrate"], optional = true } dioxus = { path = "../../../dioxus" } -dioxus-server = { path = "../../" } +dioxus-fullstack = { path = "../../" } tokio = { version = "1.27.0", features = ["full"], optional = true } serde = "1.0.159" warp = { version = "0.3.3", optional = true } @@ -17,5 +17,5 @@ execute = "0.2.12" [features] default = ["web"] -ssr = ["warp", "tokio", "dioxus-server/warp"] +ssr = ["warp", "tokio", "dioxus-fullstack/warp"] web = ["dioxus-web"] diff --git a/packages/server/examples/warp-hello-world/src/main.rs b/packages/fullstack/examples/warp-hello-world/src/main.rs similarity index 98% rename from packages/server/examples/warp-hello-world/src/main.rs rename to packages/fullstack/examples/warp-hello-world/src/main.rs index 3bbb95227..7e56659da 100644 --- a/packages/server/examples/warp-hello-world/src/main.rs +++ b/packages/fullstack/examples/warp-hello-world/src/main.rs @@ -7,7 +7,7 @@ #![allow(non_snake_case)] use dioxus::prelude::*; -use dioxus_server::prelude::*; +use dioxus_fullstack::prelude::*; use serde::{Deserialize, Serialize}; fn main() { diff --git a/packages/server/server-macro/Cargo.toml b/packages/fullstack/server-macro/Cargo.toml similarity index 100% rename from packages/server/server-macro/Cargo.toml rename to packages/fullstack/server-macro/Cargo.toml diff --git a/packages/server/server-macro/src/lib.rs b/packages/fullstack/server-macro/src/lib.rs similarity index 80% rename from packages/server/server-macro/src/lib.rs rename to packages/fullstack/server-macro/src/lib.rs index b3f890f6a..bdf755289 100644 --- a/packages/server/server-macro/src/lib.rs +++ b/packages/fullstack/server-macro/src/lib.rs @@ -2,7 +2,7 @@ use proc_macro::TokenStream; use quote::ToTokens; use server_fn_macro::*; -/// Declares that a function is a [server function](dioxus_server). This means that +/// Declares that a function is a [server function](dioxus_fullstack). This means that /// its body will only run on the server, i.e., when the `ssr` feature is enabled. /// /// If you call a server function from the client (i.e., when the `csr` or `hydrate` features @@ -20,12 +20,12 @@ use server_fn_macro::*; /// using Get instead of Post methods, the encoding must be `"GetCbor"` or `"GetJson"`. /// /// The server function itself can take any number of arguments, each of which should be serializable -/// and deserializable with `serde`. Optionally, its first argument can be a [DioxusServerContext](https::/docs.rs/dioxus-server/latest/dixous_server/prelude/struct.DioxusServerContext.html), +/// and deserializable with `serde`. Optionally, its first argument can be a [DioxusServerContext](https::/docs.rs/dioxus-fullstack/latest/dixous_server/prelude/struct.DioxusServerContext.html), /// which will be injected *on the server side.* This can be used to inject the raw HTTP request or other /// server-side context into the server function. /// /// ```ignore -/// # use dioxus_server::prelude::*; use serde::{Serialize, Deserialize}; +/// # use dioxus_fullstack::prelude::*; use serde::{Serialize, Deserialize}; /// # #[derive(Serialize, Deserialize)] /// # pub struct Post { } /// #[server(ReadPosts, "/api")] @@ -51,20 +51,20 @@ use server_fn_macro::*; /// They are serialized as an `application/x-www-form-urlencoded` /// form data using [`serde_urlencoded`](https://docs.rs/serde_urlencoded/latest/serde_urlencoded/) or as `application/cbor` /// using [`cbor`](https://docs.rs/cbor/latest/cbor/). -/// - **The [DioxusServerContext](https::/docs.rs/dioxus-server/latest/dixous_server/prelude/struct.DioxusServerContext.html) comes from the server.** Optionally, the first argument of a server function -/// can be a [DioxusServerContext](https::/docs.rs/dioxus-server/latest/dixous_server/prelude/struct.DioxusServerContext.html). This scope can be used to inject dependencies like the HTTP request +/// - **The [DioxusServerContext](https::/docs.rs/dioxus-fullstack/latest/dixous_server/prelude/struct.DioxusServerContext.html) comes from the server.** Optionally, the first argument of a server function +/// can be a [DioxusServerContext](https::/docs.rs/dioxus-fullstack/latest/dixous_server/prelude/struct.DioxusServerContext.html). This scope can be used to inject dependencies like the HTTP request /// or response or other server-only dependencies, but it does *not* have access to reactive state that exists in the client. #[proc_macro_attribute] pub fn server(args: proc_macro::TokenStream, s: TokenStream) -> TokenStream { let context = ServerContext { ty: syn::parse_quote!(DioxusServerContext), - path: syn::parse_quote!(::dioxus_server::prelude::DioxusServerContext), + path: syn::parse_quote!(::dioxus_fullstack::prelude::DioxusServerContext), }; match server_macro_impl( args.into(), s.into(), Some(context), - Some(syn::parse_quote!(::dioxus_server::prelude::server_fn)), + Some(syn::parse_quote!(::dioxus_fullstack::prelude::server_fn)), ) { Err(e) => e.to_compile_error().into(), Ok(s) => s.to_token_stream().into(), diff --git a/packages/server/src/adapters/axum_adapter.rs b/packages/fullstack/src/adapters/axum_adapter.rs similarity index 98% rename from packages/server/src/adapters/axum_adapter.rs rename to packages/fullstack/src/adapters/axum_adapter.rs index b5ee3772a..6da33c1df 100644 --- a/packages/server/src/adapters/axum_adapter.rs +++ b/packages/fullstack/src/adapters/axum_adapter.rs @@ -4,7 +4,7 @@ //! ```rust //! #![allow(non_snake_case)] //! use dioxus::prelude::*; -//! use dioxus_server::prelude::*; +//! use dioxus_fullstack::prelude::*; //! //! fn main() { //! #[cfg(feature = "web")] @@ -82,7 +82,7 @@ pub trait DioxusRouterExt { /// # Example /// ```rust /// use dioxus::prelude::*; - /// use dioxus_server::prelude::*; + /// use dioxus_fullstack::prelude::*; /// /// #[tokio::main] /// async fn main() { @@ -117,7 +117,7 @@ pub trait DioxusRouterExt { /// # Example /// ```rust /// use dioxus::prelude::*; - /// use dioxus_server::prelude::*; + /// use dioxus_fullstack::prelude::*; /// /// #[tokio::main] /// async fn main() { @@ -139,7 +139,7 @@ pub trait DioxusRouterExt { /// # Example /// ```rust /// #![allow(non_snake_case)] - /// use dioxus_server::prelude::*; + /// use dioxus_fullstack::prelude::*; /// /// #[tokio::main] /// async fn main() { @@ -165,7 +165,7 @@ pub trait DioxusRouterExt { /// ```rust /// #![allow(non_snake_case)] /// use dioxus::prelude::*; - /// use dioxus_server::prelude::*; + /// use dioxus_fullstack::prelude::*; /// /// #[tokio::main] /// async fn main() { diff --git a/packages/server/src/adapters/mod.rs b/packages/fullstack/src/adapters/mod.rs similarity index 100% rename from packages/server/src/adapters/mod.rs rename to packages/fullstack/src/adapters/mod.rs diff --git a/packages/server/src/adapters/salvo_adapter.rs b/packages/fullstack/src/adapters/salvo_adapter.rs similarity index 98% rename from packages/server/src/adapters/salvo_adapter.rs rename to packages/fullstack/src/adapters/salvo_adapter.rs index 75387d1f9..9468ec0fe 100644 --- a/packages/server/src/adapters/salvo_adapter.rs +++ b/packages/fullstack/src/adapters/salvo_adapter.rs @@ -4,7 +4,7 @@ //! ```rust //! #![allow(non_snake_case)] //! use dioxus::prelude::*; -//! use dioxus_server::prelude::*; +//! use dioxus_fullstack::prelude::*; //! //! fn main() { //! #[cfg(feature = "web")] @@ -74,7 +74,7 @@ pub trait DioxusRouterExt { /// ```rust /// use salvo::prelude::*; /// use std::{net::TcpListener, sync::Arc}; - /// use dioxus_server::prelude::*; + /// use dioxus_fullstack::prelude::*; /// /// struct ServerFunctionHandler { /// server_fn: ServerFunction, @@ -121,7 +121,7 @@ pub trait DioxusRouterExt { /// ```rust /// use salvo::prelude::*; /// use std::{net::TcpListener, sync::Arc}; - /// use dioxus_server::prelude::*; + /// use dioxus_fullstack::prelude::*; /// /// #[tokio::main] /// async fn main() { @@ -141,7 +141,7 @@ pub trait DioxusRouterExt { /// ```rust /// use salvo::prelude::*; /// use std::{net::TcpListener, sync::Arc}; - /// use dioxus_server::prelude::*; + /// use dioxus_fullstack::prelude::*; /// /// #[tokio::main] /// async fn main() { @@ -160,7 +160,7 @@ pub trait DioxusRouterExt { /// ```rust /// #![allow(non_snake_case)] /// use dioxus::prelude::*; - /// use dioxus_server::prelude::*; + /// use dioxus_fullstack::prelude::*; /// use salvo::prelude::*; /// use std::{net::TcpListener, sync::Arc}; /// diff --git a/packages/server/src/adapters/warp_adapter.rs b/packages/fullstack/src/adapters/warp_adapter.rs similarity index 99% rename from packages/server/src/adapters/warp_adapter.rs rename to packages/fullstack/src/adapters/warp_adapter.rs index 9a4ec7af4..4505fb5e1 100644 --- a/packages/server/src/adapters/warp_adapter.rs +++ b/packages/fullstack/src/adapters/warp_adapter.rs @@ -4,7 +4,7 @@ //! ```rust //! #![allow(non_snake_case)] //! use dioxus::prelude::*; -//! use dioxus_server::prelude::*; +//! use dioxus_fullstack::prelude::*; //! //! fn main() { //! #[cfg(feature = "web")] @@ -118,7 +118,7 @@ where /// /// # Example /// ```rust -/// use dioxus_server::prelude::*; +/// use dioxus_fullstack::prelude::*; /// /// #[tokio::main] /// async fn main() { @@ -148,7 +148,7 @@ pub fn register_server_fns(server_fn_route: &'static str) -> BoxedFilter<(impl R /// ```rust /// #![allow(non_snake_case)] /// use dioxus::prelude::*; -/// use dioxus_server::prelude::*; +/// use dioxus_fullstack::prelude::*; /// /// #[tokio::main] /// async fn main() { @@ -348,7 +348,7 @@ fn report_err(e: E) -> Box { /// # Example /// ```rust /// #![allow(non_snake_case)] -/// use dioxus_server::prelude::*; +/// use dioxus_fullstack::prelude::*; /// /// #[tokio::main] /// async fn main() { diff --git a/packages/server/src/hot_reload.rs b/packages/fullstack/src/hot_reload.rs similarity index 100% rename from packages/server/src/hot_reload.rs rename to packages/fullstack/src/hot_reload.rs diff --git a/packages/server/src/lib.rs b/packages/fullstack/src/lib.rs similarity index 82% rename from packages/server/src/lib.rs rename to packages/fullstack/src/lib.rs index 8d18dca2a..be437bc53 100644 --- a/packages/server/src/lib.rs +++ b/packages/fullstack/src/lib.rs @@ -17,7 +17,7 @@ mod serve_config; mod server_context; mod server_fn; -/// A prelude of commonly used items in dioxus-server. +/// A prelude of commonly used items in dioxus-fullstack. pub mod prelude { #[cfg(feature = "axum")] pub use crate::adapters::axum_adapter::*; @@ -30,10 +30,10 @@ pub mod prelude { #[cfg(feature = "ssr")] pub use crate::render::SSRState; #[cfg(feature = "ssr")] - pub use crate::serve_config::{ ServeConfig, ServeConfigBuilder}; + pub use crate::serve_config::{ServeConfig, ServeConfigBuilder}; #[cfg(feature = "ssr")] - pub use crate::server_context::{RequestParts}; - pub use crate::server_context::{ DioxusServerContext, HasServerContext}; + pub use crate::server_context::RequestParts; + pub use crate::server_context::{DioxusServerContext, HasServerContext}; pub use crate::server_fn::ServerFn; #[cfg(feature = "ssr")] pub use crate::server_fn::{ServerFnTraitObj, ServerFunction}; diff --git a/packages/server/src/props_html/deserialize_props.rs b/packages/fullstack/src/props_html/deserialize_props.rs similarity index 85% rename from packages/server/src/props_html/deserialize_props.rs rename to packages/fullstack/src/props_html/deserialize_props.rs index dcaa19905..35e54a1e5 100644 --- a/packages/server/src/props_html/deserialize_props.rs +++ b/packages/fullstack/src/props_html/deserialize_props.rs @@ -14,7 +14,7 @@ pub(crate) fn serde_from_string(string: &str) -> Option #[cfg(not(feature = "ssr"))] /// Get the props from the document. This is only available in the browser. /// -/// When dioxus-server renders the page, it will serialize the root props and put them in the document. This function gets them from the document. +/// When dioxus-fullstack renders the page, it will serialize the root props and put them in the document. This function gets them from the document. pub fn get_root_props_from_document() -> Option { #[cfg(not(target_arch = "wasm32"))] { diff --git a/packages/server/src/props_html/mod.rs b/packages/fullstack/src/props_html/mod.rs similarity index 100% rename from packages/server/src/props_html/mod.rs rename to packages/fullstack/src/props_html/mod.rs diff --git a/packages/server/src/props_html/serialize_props.rs b/packages/fullstack/src/props_html/serialize_props.rs similarity index 100% rename from packages/server/src/props_html/serialize_props.rs rename to packages/fullstack/src/props_html/serialize_props.rs diff --git a/packages/server/src/render.rs b/packages/fullstack/src/render.rs similarity index 100% rename from packages/server/src/render.rs rename to packages/fullstack/src/render.rs diff --git a/packages/server/src/serve_config.rs b/packages/fullstack/src/serve_config.rs similarity index 100% rename from packages/server/src/serve_config.rs rename to packages/fullstack/src/serve_config.rs diff --git a/packages/server/src/server_context.rs b/packages/fullstack/src/server_context.rs similarity index 100% rename from packages/server/src/server_context.rs rename to packages/fullstack/src/server_context.rs diff --git a/packages/server/src/server_fn.rs b/packages/fullstack/src/server_fn.rs similarity index 100% rename from packages/server/src/server_fn.rs rename to packages/fullstack/src/server_fn.rs