dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

dioxus 0.7 | Server Functions :: HTTP methods

Open dxps opened this issue 3 months ago • 0 comments

Feature Request

In Dioxus 0.6, such construct registered a GET /... server function (and that's it):

#[server(endpoint = "admin/list_attr_defs", input = GetUrl)]
pub async fn list_attribute_defs() -> Result<Vec<AttributeDef>, ServerFnError> { ... }

Now, in the current Dioxus 0.7.2, such construct registers a POST /api/list_dogs server function:

#[server(endpoint = "list_dogs", input = GetUrl)]
pub async fn sf_list_dogs() -> Result<Vec<(usize, String)>, ServerFnError> { ... }

Of course, annotating it with #[get("/api/list_dogs")] registers a GET /api/list_dogs server functions:

#[server(endpoint = "list_dogs", input = GetUrl)]
#[get("/api/list_dogs")]
pub async fn sf_list_dogs() -> Result<Vec<(usize, String)>, ServerFnError> { ... }

But it still generates the POST /api_list_dogs server function, although that won't be used.


Implement Suggestion

It would be nice to keep having that option to generate "clean" (and minimal enough) server functions with the desired paths and HTTP verbs.

ServerFnArgs rust doc explicitly mentions that it will be removed. Therefore, are you planning to keep providing an option to explicitly define the server function as per our own desire (and OCD 😋)❔

Thank you!

dxps avatar Dec 06 '25 12:12 dxps