Execute edge functions.
- moment - used for date parsing and manipulation
- env - variables either passed via API or through GORULES_EXPOSED_ environment variable for on-premise hosting
Maximum execution time of the function is limited to 50ms.
To start off create a simple decision with input, function node and an output through graph edit mode. Switch back to content edit mode and click on the function node (Open).
By default, function will return anything that is provided as an input.
Writing a sample function
Let's create a function that will calculate the sum of all numbers provided in the request. Our expected JSON for the request will be:
"numbers": [1, 2, 3, 4]
And our function will look something like this:
To debug a function you may use
console.log statements. It supports all primitive data types which can be
represented in JSON format.
As an example: