Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server$ function arguments can now be taken from query params #1028

Closed
wants to merge 3 commits into from

Conversation

Tommypop2
Copy link
Contributor

@Tommypop2 Tommypop2 commented Aug 24, 2023

Allows for server$ functions to receive arguments through the query params of a GET request. This allows for server$ functions to be used to generate assets such as dynamic images, where args could be sent via get params in the img tag's src url to influence the final image.

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • infrastructure changes
  • Other... Please describe:

What is the current behavior?

Currently, server$ functions called through a GET request to their URL are given no arguments

What is the new behavior?

An args query param is used to pass arguments to server$ functions as a last resort.
For example, the following function, when accessed through <server_function_url>?args=[1,2]), would produce the result "3":

const data = server$((var1, var2) => {
	return (var1 + var2).toString();
});

@Tommypop2 Tommypop2 closed this Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant