add server function middleware

This commit is contained in:
Evan Almloff committed 2023-07-07 18:25:45 -07:00
1 parent c49c75cb60
commit 14883bb711
12 files changed
+446 -171

No files matched your search

@@ -41,9 +41,9 @@ fn app(cx: Scope<AppProps>) -> Element {
}
#[server(PostServerData)]
#[middleware(Auth(AuthLevel::Admin))]
#[middleware(tower_http::validate_request::ValidateRequestHeaderLayer::bearer("passwordlol"))]
async fn post_server_data(
#[extract] Axum(axum::extract::Host(host), _): Axum<_, _>,
#[extract] axum::extract::Host(host): axum::extract::Host,
data: String,
) -> Result<(), ServerFnError> {
println!("Server received: {}", data);