# Getting Started

### Install Slack app

<figure><img src="https://2111078748-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe3eqcQbaUhi1FApXyS9j%2Fuploads%2Fy1GkWuDIKghF4yjo75MI%2Fadd-slack.png?alt=media&#x26;token=02d59d80-68d7-466a-a2a6-03f4bd631dc6" alt=""><figcaption></figcaption></figure>

Click 'Add to  Slack' button

<figure><img src="https://2111078748-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe3eqcQbaUhi1FApXyS9j%2Fuploads%2FHCQ8A91gMsPrL8TlBDUo%2Fadd-slack-button.png?alt=media&#x26;token=fca92836-e331-43ce-88a5-07ad7b3a97eb" alt=""><figcaption></figcaption></figure>

install the Restsocket Slack app in Slack.

<figure><img src="https://2111078748-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe3eqcQbaUhi1FApXyS9j%2Fuploads%2FgrZHcY1doF1sDHiLe5iN%2Fallow-app.png?alt=media&#x26;token=543dfbe9-c1a2-4b60-8b1d-388acfe4228e" alt=""><figcaption></figcaption></figure>

### Register, log In & connect

Use Restsocket in the Slack chat window as follows: after registering, logging in, and connecting. Once you register, you can log in and start using it.

<figure><img src="https://2111078748-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe3eqcQbaUhi1FApXyS9j%2Fuploads%2FX2fJUT4iTenQHVLGkQTh%2Frs-cap-2.png?alt=media&#x26;token=ee10c97e-6fcb-4b0a-97a3-c31486d52881" alt=""><figcaption></figcaption></figure>

As shown above, you can register users, set up the DB connection, and test the REST API through the Restsocket Slack app chat. (The email, Bearer token, and connection information above are fictional. You must use information appropriate for the user for it to work.)

After configuring the connection, you can directly call the REST API at the designated endpoint using the Bearer token.

### Register

> &#x20;/register \[email]

### Login

Get the Bearer token from your registered email

> &#x20;/login  \[email]  \[Bearer token]

The Bearer token will be sent to the registered email. Log in using the token that starts with 'Bearer.' This token consists of the word 'Bearer' followed by a space and 43 random characters.

### Connect &  Start your server

Connect to the database (Start REST API server).

> &#x20;/connect  \[Host]  \[Port]  \[DB user]  \[DB  password]  \[Database name]&#x20;

&#x20;When you run /connect, the Restsocket server will connect to the database, and the server will start immediately.Example

After installing the app, you can execute the following steps in the Restsocket chat window.

```
/register abc@email.com

/login abc@email.com Bearer HeQYBbcAOMGfc4cQomxHFlKhjJO94jWHeQYOfo70gqL

/connect 111.222.123.121 3306 admin pass1234!! mydatabase 
```

(The email, Bearer token, and connection information above are fictional. Please use the user's information.)

### Test

After connecting to the database, you can immediately use the REST API.

&#x20;You can check the list of tables by using the /tables command.

```
/tables

{"code":200,"data":["address","users","table1"]}
```

&#x20;Use it in JavaScript as follows.

```javascript

fetch('https://r-sock.com/api/fetch/users', {
    method: 'POST',
    headers: {
        'Authorization': 'Bearer your_token',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({ id: 3 })
})
.then(response => response.json()
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

```

By default, you can easily configure REST API calls using the table name and column names.  &#x20;
