integrate extractors with the macro

This commit is contained in:
Evan Almloff committed 2023-07-07 11:03:59 -07:00
1 parent 4f6e6a7c0d
commit 7597068af6
5 files changed
+102 -12

No files matched your search

@@ -19,3 +19,10 @@ execute = "0.2.12"
default = []
ssr = ["axum", "tokio", "dioxus-fullstack/axum"]
web = ["dioxus-web"]
[profile.release]
lto = true
panic = "abort"
opt-level = 'z'
strip = true
codegen-units = 1
@@ -41,13 +41,12 @@ fn app(cx: Scope<AppProps>) -> Element {
}
#[server(PostServerData)]
async fn post_server_data(data: String) -> Result<(), ServerFnError> {
// The server context contains information about the current request and allows you to modify the response.
let cx = server_context();
cx.response_headers_mut()
.insert("Set-Cookie", "foo=bar".parse().unwrap());
async fn post_server_data(
#[extract] Axum(axum::extract::Host(host), _): Axum<_, _>,
data: String,
) -> Result<(), ServerFnError> {
println!("Server received: {}", data);
println!("Request parts are {:?}", cx.request_parts());
println!("{:?}", host);
Ok(())
}