Back

How to share code between functions

  • 0
  • Tools
  • Functions
wintercounter✌🏼
8 Oct, 2023, 10:09

There are some codes, like setting headers and other utils I want to share between functions. Having them in a utils folder at the root of my project is not working, since only the function's path is deployed. Any ideas how I can reuse some utils?

TL;DR
One way to share code between functions is to create a separate folder for the common code and use symlinks. You can create a symlink in each function's folder that points to the common code folder. This way, the functions can access and reuse the shared code.
Drake
11 Oct, 2023, 02:13

you'll need to create a symlink in your function folder that points to the common code

Drake
11 Oct, 2023, 02:14
wintercounter✌🏼
11 Oct, 2023, 06:45

at the end I went with a single folder for all functions and different entry points

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