Writing Functions

Build the Cloud Functions by writing JavaScript code.

There is a list of things you need to know about writing Cloud Functions using our boilerplate.

  1. You can write your function in JavaScript.

  2. Functions implementation lives inside of /functions directory, e.g., /functions/hellowWorld.

  3. Every function is an independent Node.js module with its own dependencies.

  4. The entry point of every function is always the main.js file, e.g., /functions/helloWorld/main.js.

  5. Every function needs a configuration file with metadata about the function.

You can also build your functions by writing "TypeScript" as long as you push a build code that contains the main.js file at the root of each function.

What do you need to know about writing functions?

  1. Function Anatomy: understand the function folder structure.

  2. Configuration file: implement the configuration of your function.

  3. Function Triggers: define the trigger of your function.

  4. Environment Variables: define the environment variables of your function.

  5. Documentation: explain how your function works.

You can check the https://github.com/nexxtway/functions.store-learning workspace example on GitHub to see how functions are created.

Last updated