DioxusLabs / DioxusLabs/dioxus

dioxus 0.7 | Server Functions :: HTTP methods

Open
#5,060 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

## Feature Request

In Dioxus 0.6, such construct registered a `GET /...` server function (and that's it):
```rs
#[server(endpoint = "admin/list_attr_defs", input = GetUrl)]
pub async fn list_attribute_defs() -> Result, ServerFnError> { ... }
```

Now, in the current Dioxus 0.7.2, such construct registers a `POST /api/list_dogs` server function:
```rs
#[server(endpoint = "list_dogs", input = GetUrl)]
pub async fn sf_list_dogs() -> Result, ServerFnError> { ... }
```

Of course, annotating it with `#[get("/api/list_dogs")]` registers a `GET /api/list_dogs` server functions:
```rs
#[server(endpoint = "list_dogs", input = GetUrl)]
#[get("/api/list_dogs")]
pub async fn sf_list_dogs() -> Result, 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!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.