diff --git a/packages/cli/src/server/web/mod.rs b/packages/cli/src/server/web/mod.rs index bef52efd4..115310916 100644 --- a/packages/cli/src/server/web/mod.rs +++ b/packages/cli/src/server/web/mod.rs @@ -336,7 +336,7 @@ async fn setup_router( router = if let Some(base_path) = config.dioxus_config.web.app.base_path.clone() { let base_path = format!("/{}", base_path.trim_matches('/')); Router::new() - .nest(&base_path, axum::routing::any_service(router.into())) + .route(&base_path, axum::routing::any_service(router.into())) .fallback(get(move || { let base_path = base_path.clone(); async move { format!("Outside of the base path: {}", base_path) } diff --git a/packages/cli/src/server/web/proxy.rs b/packages/cli/src/server/web/proxy.rs index 3158fa286..facb9dce8 100644 --- a/packages/cli/src/server/web/proxy.rs +++ b/packages/cli/src/server/web/proxy.rs @@ -4,12 +4,13 @@ use dioxus_cli_config::WebProxyConfig; use anyhow::Context; use axum::{http::StatusCode, routing::any, Router}; use hyper::{Request, Response, Uri}; +use hyper::client::legacy::Client; use axum::body::Body as MyBody; #[derive(Debug, Clone)] struct ProxyClient { - inner: hyper::Client>, + inner: Client>, url: Uri, } @@ -22,7 +23,7 @@ impl ProxyClient { .enable_http1() .build(); Self { - inner: hyper::Client::builder().build(https), + inner: Client::builder().build(https), url, } } @@ -98,6 +99,7 @@ mod test { use super::*; use axum::{extract::Path, Router}; + use axum_server::Server; fn setup_servers( mut config: WebProxyConfig, @@ -110,13 +112,13 @@ mod test { "/*path", any(|path: Path| async move { format!("backend: {}", path.0) }), ); - let backend_server = axum::Server::bind(&"127.0.0.1:0".parse().unwrap()) + let backend_server = Server::bind(&"127.0.0.1:0".parse().unwrap()) .serve(backend_router.into_make_service()); let backend_addr = backend_server.local_addr(); let backend_handle = tokio::spawn(async move { backend_server.await.unwrap() }); config.backend = format!("http://{}{}", backend_addr, config.backend); let router = super::add_proxy(Router::new(), &config); - let server = axum::Server::bind(&"127.0.0.1:0".parse().unwrap()) + let server = Server::bind("127.0.0.1:0".parse().unwrap()) .serve(router.unwrap().into_make_service()); let server_addr = server.local_addr(); let server_handle = tokio::spawn(async move { server.await.unwrap() }); @@ -132,8 +134,8 @@ mod test { // So in day to day usage, use `http://localhost:8000/api` instead! backend: path, }; - let (backend_handle, server_handle, server_addr) = setup_servers(config); - let resp = hyper::Client::new() + let (backend_handle, server_handle, server_addr) = setup_servers(config).await; + let resp = Client::new() .get(format!("http://{}/api", server_addr).parse().unwrap()) .await .unwrap(); @@ -145,7 +147,7 @@ mod test { "backend: /api" ); - let resp = hyper::Client::new() + let resp = Client::new() .get(format!("http://{}/api/", server_addr).parse().unwrap()) .await .unwrap(); @@ -157,7 +159,7 @@ mod test { "backend: /api/" ); - let resp = hyper::Client::new() + let resp = Client::new() .get( format!("http://{}/api/subpath", server_addr) .parse() diff --git a/packages/fullstack/examples/axum-auth/src/main.rs b/packages/fullstack/examples/axum-auth/src/main.rs index 47269f661..e1638e1b6 100644 --- a/packages/fullstack/examples/axum-auth/src/main.rs +++ b/packages/fullstack/examples/axum-auth/src/main.rs @@ -49,7 +49,7 @@ fn main() { // build our application with some routes let app = Router::new() // Server side render the application, serve static assets, and register server functions - .serve_dioxus_application("", ServeConfig::builder().build(), || { + .serve_dioxus_application(ServeConfig::builder().build(), || { VirtualDom::new(app) }) .layer( diff --git a/packages/fullstack/examples/axum-desktop/src/server.rs b/packages/fullstack/examples/axum-desktop/src/server.rs index 31eae03e8..933f44227 100644 --- a/packages/fullstack/examples/axum-desktop/src/server.rs +++ b/packages/fullstack/examples/axum-desktop/src/server.rs @@ -12,8 +12,8 @@ async fn main() { .await .unwrap(); - let _ = PostServerData::register_explicit(); - let _ = GetServerData::register_explicit(); + let _ = register_explicit::(); + let _ = register_explicit::(); axum::serve( listener, diff --git a/packages/fullstack/examples/static-hydrated/src/main.rs b/packages/fullstack/examples/static-hydrated/src/main.rs index fb0e20618..c3c988e49 100644 --- a/packages/fullstack/examples/static-hydrated/src/main.rs +++ b/packages/fullstack/examples/static-hydrated/src/main.rs @@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize}; #[cfg(feature = "server")] #[tokio::main] async fn main() { - pre_cache_static_routes_with_props( + pre_cache_static_routes( &ServeConfig::new_with_router( dioxus_fullstack::router::FullstackRouterConfig::::default(), ) diff --git a/packages/server-macro/Cargo.toml b/packages/server-macro/Cargo.toml index 52c6975ff..29988789b 100644 --- a/packages/server-macro/Cargo.toml +++ b/packages/server-macro/Cargo.toml @@ -23,7 +23,6 @@ server_fn_macro = "^0.6.5" proc-macro = true [features] -actix = ["server_fn_macro/actix"] axum = ["server_fn_macro/axum"] nightly = ["server_fn_macro/nightly"] server = ["server_fn_macro/ssr"]