Node
We have a default Node 6.10(LTS) support on our platform. Custom version support also available on request.
Since backbench is a Faas integrated with APIGATEWAY we provide a static convention to map your functions to API endpoints. (we call em public functions). And this is how we define them -
arg1
is the request object for node. This containers information about the HTTP state. Goes as;
arg2
is a nodejs callback and is optional. Callback will let you see the response on your APIs. (not console.log)
Note: callback function should have an argument which is JSON.parsed
.
To log your application, use console.log() and logs will be generated on Logs section.
To check compilation error, click on bug button(integrated JSHint).
For runtime failure, see your bench's dashboard.
Restrictions
Module name cannot be
func.js
.Callback function's argument should be
JSON.parsed()
to use.
Example
API to display Hello World!
2. Running a background process (without callback).
3. Using ESv6
4. Using node async/await
.
More about callback function
error
– is an optional parameter that you can use to provide results of the failed function execution. When a function succeeds, you can passnull
as the first parameter.result
– is an optional parameter that you can use to provide the result of a successful function execution. The result provided must beJSON.parse()
compatible. If an error is provided, this parameter is ignored.
Last updated