index.js Implementation
Last updated
Last updated
The file index.js
that is found in the top-level directory of your unique ID is the main entry point of your lambda function. This file should contain the majority of your JavaScript logic.
The file must export in the function register
which registers the that the lambda function is listening on.
The file may import additional .js
and .json
dependencies that must be found in the same directory as the file index.js
itself (or under a subdirectory next to it).
Importing must use the require()
syntax.
NPM packages may also be imported, subject to being in the .
Asynchronous code can and should use the modern async await
syntax directly.
The following example monitors an borrowing position every 10 minutes and if the position is close to liquidation, closes it using a contract that was deployed in advance for this lambda.