> For the complete documentation index, see [llms.txt](https://xomlo.gitbook.io/xomlo-io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xomlo.gitbook.io/xomlo-io/using-xomlo.io-sdk/master.md).

# Getting started

## Creating first-ever connector

{% hint style="info" %}
You need to have `yarn` and `node` installed on your computer.
{% endhint %}

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`:

{% code title="./src/index.ts" %}

```typescript
import { functions } from '@xomlo/xomlo-sdk';

interface Payload {
    [key: string]: string;
}

functions.main(async (payload: Payload) => {
    // Print current payload
    functions.logger.info('Hello from Xomlo connector!');
    functions.logger.info('Payload', payload);

    // Download test data and save into ./output/data.json
    const { body } = await functions.http.get('https://api.thecatapi.com/v1/images/search');
    functions.storage.saveOutput('data.json', body);
});

```

{% endcode %}

You can test your connector locally by running the following commands in your console:

```bash
$ yarn build
$ yarn start
```

The connector should return into the console:

```bash
$ Starting ...
$ debug:   ▪ Connector started in develop mode +0ms
$ debug:   ▪ Loading envs startsWith XOMLO_PAYLOAD_ from .env file +3ms
$ debug:   ▪ Connector status: RUNNING +1ms
$ info:    ▪ Hello from Xomlo connector! +2ms
$ info:    ┏ Payload +1ms
$ info:    ┗ [1] { someEnvVariable: 'someValue' }
$ debug:   ▪ HTTP GET request: https://api.thecatapi.com/v1/images/search +7ms
$ debug:   ▪ Connector status: FINISHED, elapsedTime: 377ms +368ms
$ debug:   ▪ Connector finished +1ms
```

### Code breakdown

All connector logic must be written in the main function. Anything outside won't be run properly in the Xomlo.io runtime environment.

```typescript
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.

```typescript
import { functions } from '@xomlo/xomlo-sdk';

functions.main(async () => {
    functions.logger.info('Hello from Xomlo connector!');
});
```
