Intro to Resources and Cloud Functions
What is a Resource?
A resource is a script that can have its state stored to disk. It can be instantiated as many times as you like, and linked to any number of paths.
Functions can be called on the resource via an invoke command.
A typical client request makes a round trip that looks like this:
Client Makes Request -> HTTP Method (endpoint) Receives Request Data -> Invoke Function On Resource -> Return to HTTP Method -> Send Response to Client
Any errors that occur along this path would return a 500 error to the client. It's important to do all appropriate error handling, and return error codes accordingly.
Why Should I Use Cloud Functions?
Cloud functions allow you to define how to handle and manipulate data sent from the client. They allow you to interact with resources, and leverage Elements' built in horizontal scaling to make full use of the cloud. From large-scale asynchronous processing to simply storing user data, cloud functions are versitile and powerful.