Skip to content

dioxus 0.7 | Server Functions :: HTTP methods #5060

@dxps

Description

@dxps

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions