You need to have yarn and node installed on your computer.
Create a Xomlo.io project in your local folder:
$ yarn create @xomlo/xomlo-app
You will be prompted for a project type and project name. Choose connector and test-connector for the name. The builder will create the project into the ./test-connector folder.
The following code will be generated in ./src/index.ts:
./src/index.ts
import { functions } from'@xomlo/xomlo-sdk';interfacePayload { [key:string]:string;}functions.main(async (payload:Payload) => {// Print current payloadfunctions.logger.info('Hello from Xomlo connector!');functions.logger.info('Payload', payload);// Download test data and save into ./output/data.jsonconst { body } =awaitfunctions.http.get('https://api.thecatapi.com/v1/images/search');functions.storage.saveOutput('data.json', body);});
You can test your connector locally by running the following commands in your console:
All connector logic must be written in the main function. Anything outside won't be run properly in the Xomlo.io runtime environment.
import { functions } from'@xomlo/xomlo-sdk';functions.main(async () => {// our code should be here});
Always use our custom logger instead of console.log(). You must do this because all logs are sent to our application after the connector is finished in the Xomlo.io runtime.