Make desktop fullstack work with the CLI (#2862)
* Make desktop fullstack work with the CLI * Simplify desktop fullstack example * move the profiles to the workspace
This commit is contained in:
1 parent
6a46a66c9a
commit
5a7a91323a
23 files changed
+239
-259
No files matched your search
@@ -146,24 +146,30 @@ async fn launch_server(
|
||||
{
|
||||
use crate::axum_adapter::DioxusRouterExt;
|
||||
|
||||
let router = axum::Router::new().register_server_functions_with_context(context_providers);
|
||||
#[allow(unused_mut)]
|
||||
let mut router =
|
||||
axum::Router::new().register_server_functions_with_context(context_providers);
|
||||
|
||||
#[cfg(not(any(feature = "desktop", feature = "mobile")))]
|
||||
let router = {
|
||||
{
|
||||
use crate::prelude::RenderHandleState;
|
||||
use crate::prelude::SSRState;
|
||||
|
||||
let cfg = platform_config.server_cfg.build();
|
||||
match platform_config.server_cfg.build() {
|
||||
Ok(cfg) => {
|
||||
router = router.serve_static_assets();
|
||||
|
||||
let mut router = router.serve_static_assets();
|
||||
|
||||
router.fallback(
|
||||
axum::routing::get(crate::axum_adapter::render_handler).with_state(
|
||||
RenderHandleState::new_with_virtual_dom_factory(build_virtual_dom)
|
||||
.with_config(cfg),
|
||||
),
|
||||
)
|
||||
};
|
||||
router = router.fallback(
|
||||
axum::routing::get(crate::axum_adapter::render_handler).with_state(
|
||||
RenderHandleState::new_with_virtual_dom_factory(cfg, build_virtual_dom),
|
||||
),
|
||||
);
|
||||
}
|
||||
Err(err) => {
|
||||
tracing::trace!("Failed to create render handler. This is expected if you are only using fullstack for desktop/mobile server functions: {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let router = router.into_make_service();
|
||||
let listener = tokio::net::TcpListener::bind(address).await.unwrap();
|
||||
|
||||
Reference in new issue
Block a user