|
@@ -14,7 +14,10 @@
|
|
|
//! tokio::runtime::Runtime::new()
|
|
|
//! .unwrap()
|
|
|
//! .block_on(async move {
|
|
|
-//! let listener = tokio::net::TcpListener::bind("127.0.0.01:8080")
|
|
|
+//! // Get the address the server should run on. If the CLI is running, the CLI proxies fullstack into the main address
|
|
|
+//! // and we use the generated address the CLI gives us
|
|
|
+//! let address = dioxus_cli_config::fullstack_address_or_localhost();
|
|
|
+//! let listener = tokio::net::TcpListener::bind(address)
|
|
|
//! .await
|
|
|
//! .unwrap();
|
|
|
//! axum::serve(
|
|
@@ -82,7 +85,7 @@ pub trait DioxusRouterExt<S> {
|
|
|
/// # use dioxus_fullstack::prelude::*;
|
|
|
/// #[tokio::main]
|
|
|
/// async fn main() {
|
|
|
- /// let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 8080));
|
|
|
+ /// let addr = dioxus_cli_config::fullstack_address_or_localhost();
|
|
|
/// let router = axum::Router::new()
|
|
|
/// // Register server functions routes with the default handler
|
|
|
/// .register_server_functions()
|
|
@@ -107,7 +110,7 @@ pub trait DioxusRouterExt<S> {
|
|
|
/// # use std::sync::Arc;
|
|
|
/// #[tokio::main]
|
|
|
/// async fn main() {
|
|
|
- /// let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 8080));
|
|
|
+ /// let addr = dioxus_cli_config::fullstack_address_or_localhost();
|
|
|
/// let router = axum::Router::new()
|
|
|
/// // Register server functions routes with the default handler
|
|
|
/// .register_server_functions_with_context(Arc::new(vec![Box::new(|| Box::new(1234567890u32))]))
|
|
@@ -127,7 +130,7 @@ pub trait DioxusRouterExt<S> {
|
|
|
/// # use dioxus_fullstack::prelude::*;
|
|
|
/// #[tokio::main]
|
|
|
/// async fn main() {
|
|
|
- /// let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 8080));
|
|
|
+ /// let addr = dioxus_cli_config::fullstack_address_or_localhost();
|
|
|
/// let router = axum::Router::new()
|
|
|
/// // Server side render the application, serve static assets, and register server functions
|
|
|
/// .serve_static_assets()
|
|
@@ -152,7 +155,7 @@ pub trait DioxusRouterExt<S> {
|
|
|
/// # use dioxus_fullstack::prelude::*;
|
|
|
/// #[tokio::main]
|
|
|
/// async fn main() {
|
|
|
- /// let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 8080));
|
|
|
+ /// let addr = dioxus_cli_config::fullstack_address_or_localhost();
|
|
|
/// let router = axum::Router::new()
|
|
|
/// // Server side render the application, serve static assets, and register server functions
|
|
|
/// .serve_dioxus_application(ServeConfig::new().unwrap(), app)
|
|
@@ -358,7 +361,7 @@ impl RenderHandleState {
|
|
|
///
|
|
|
/// #[tokio::main]
|
|
|
/// async fn main() {
|
|
|
-/// let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 8080));
|
|
|
+/// let addr = dioxus_cli_config::fullstack_address_or_localhost();
|
|
|
/// let router = axum::Router::new()
|
|
|
/// // Register server functions, etc.
|
|
|
/// // Note you can use `register_server_functions_with_context`
|