Skip to content

Introduction

Server side functions or SSF or SSF:s are small snippets of code which runs in a controlled environment on the Arrigo Local server. SSF:s should be considered as non-persistent functions. They should not contain any stateful data, like objects or persistent settings. With an SSF following operations can easily be implemented:

  • Read/Write from/to a json file
  • Query the Database
  • Fetch data from an API
  • Read/Write data from/to a device

Advanced users can easily extend arrigo with a service.

How stuff works

Each time a Server Side JS attribute is non empty in any EXOconfig file, that content is treated as a collection of server side functions. The attribute must export its functions through a return statement as the last statement in the attribute.

Example of server side function block code
function add(kwargs, callInfo){
  return kwargs.a + kwargs.b;
}

return { add }

The above example defines the function add, and at the bottom exports it. The execute call to the service takes a path and a methodName as parameters. The methodName is one of the exported names from the initial function export.