Back

how to send data to "on user creation" server function?

  • 0
  • Functions
  • Web
manazo
29 Oct, 2023, 08:47

i'm writing a server function that'll create a doc in "Users" collection on each user creation. but i wanna collect and store more data from the user. maybe their city, zip code and stuff. so how can i send those data to my function so that i can store those in the doc? I'm using email-password based login

TL;DR
The user wants to know how to send additional data to a server function that creates a document in the "Users" collection upon user creation. They also ask about the consolidation of API calls and the safety of performing tasks on the server side compared to the client side. One suggestion given is to create the account with a user-executed function instead of using the account.create() method. Solution: To send additional data to the server function, you can store the data in variables and pass them as parameters when calling the function. As for consolidating API calls, it depends on the specific requirements and implementation. Performing tasks on the server side is
manazo
29 Oct, 2023, 09:47

how to send data to "on user creation" server function?

Drake
29 Oct, 2023, 15:09

I would suggest creating the account with a function the user executes rather than using account.create() and a function triggered by event

manazo
29 Oct, 2023, 23:28

then what difference it would make if we do account.create() and then databases.createDocument() in the client side directly?

Drake
29 Oct, 2023, 23:30

Consolidating the API call and making sure to do validation

manazo
29 Oct, 2023, 23:36

about consolidating the API calls, even if we do it in the server function, we still need to do account.create() and then databases.createDocument(). don't we? so are the API calls really getting consolidated?

and about validation, is it safer for any task to be done in the server function compared to the client side?

Drake
29 Oct, 2023, 23:42

There consolidated on the front end

Drake
29 Oct, 2023, 23:42

If you need validation, yes, use function

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more