codify "platform" into resolution logic, server-fn/fullstack overhaul (#4596)
overhaul dioxus fullstack using a new implementation of server_fn This PR is a complete rewrite of dioxus fullstack designed to improve compatibility with axum and to fix a number of compilation errors based on feature flag unification plumbing through macros.
This commit is contained in:
1 parent
8421c3aef0
commit
f2b1c6d97f
424 files changed
+17284
-6624
No files matched your search
@@ -0,0 +1,24 @@
|
||||
//! A simple example using Dioxus Fullstack to call a server action.
|
||||
//!
|
||||
//! the `get`, `post`, `put`, `delete`, etc macros are used to define server actions that can be
|
||||
//! called from the client. The action can take arguments and return a value, and the client
|
||||
//! will automatically serialize and deserialize the data.
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus::launch(|| {
|
||||
let mut message = use_action(get_message);
|
||||
|
||||
rsx! {
|
||||
h1 { "Server says: "}
|
||||
pre { "{message:?}"}
|
||||
button { onclick: move |_| message.call("world".into(), 30), "Click me!" }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[get("/api/{name}/?age")]
|
||||
async fn get_message(name: String, age: i32) -> Result<String> {
|
||||
Ok(format!("Hello {}, you are {} years old!", name, age))
|
||||
}
|
||||
Reference in new issue
Block a user