> For the complete documentation index, see [llms.txt](https://undefined-296.gitbook.io/random-motivation-wise-saying/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://undefined-296.gitbook.io/random-motivation-wise-saying/random-motivation-wise-saying.md).

# Random-Motivation-Wise-saying

## Login

<mark style="color:green;">`POST`</mark> `https://Random-Motivation-Wise-saying/users/login`

#### Request Body

| Name                                       | Type   | Description   |
| ------------------------------------------ | ------ | ------------- |
| email<mark style="color:red;">\*</mark>    | String | user email    |
| password<mark style="color:red;">\*</mark> | String | user password |

{% tabs %}
{% tab title="200: OK Login success" %}

```javascript
{
    "id": 1,
    "username": "kimcoding",
    "email": "kimcoding@codestates.com",
}
```

{% endtab %}

{% tab title="500: Internal Server Error Response error message" %}

```javascript
{
    "Server error"
}
```

{% endtab %}

{% tab title="401: Unauthorized Login fail message" %}

```javascript
{
    "Invalid user or wrong password"
}
```

{% endtab %}
{% endtabs %}

## Signout

<mark style="color:green;">`POST`</mark> `https://Random-Motivation-Wise-saying/users/signout`

User logout

#### Headers

| Name         | Type   | Description                         |
| ------------ | ------ | ----------------------------------- |
| Authorizaion | String | express-session(req.session.userid) |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "Success logout"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "You're currently not logined"
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```javascript
{
    "Server error"
}
```

{% endtab %}
{% endtabs %}

## Signup

<mark style="color:green;">`POST`</mark> `https://Random-Motivation-Wise-saying/users/signup`

User signup

#### Request Body

| Name                                       | Type   | Description   |
| ------------------------------------------ | ------ | ------------- |
| username<mark style="color:red;">\*</mark> | String | user name     |
| email<mark style="color:red;">\*</mark>    | String | user email    |
| password<mark style="color:red;">\*</mark> | String | user password |

{% tabs %}
{% tab title="201: Created " %}

```javascript
{
    "id": 1,
    "username": "kimcoding",
    "email": "kimcoding@codestates.com",
    "updatedAt": "2022.05.13 08:00",
    "createdAt": "2022.05.13 08:00"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "이미 존재하는 이메일입니다"
}
```

{% endtab %}

{% tab title="403: Forbidden " %}

```javascript
{
    "Wrong username or email or password"
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```javascript
{
    "error"
}
```

{% endtab %}
{% endtabs %}

## User info

<mark style="color:blue;">`GET`</mark> `https://Random-Motivation-Wise-saying/users/:userId`

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "id": 1,
    "username": "kimcoding",
    "email": "kimcoding@codestates.com",
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```javascript
{
    "로그인 정보가 확인되지 않습니다"
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```javascript
{
    "Server error"
}
```

{% endtab %}
{% endtabs %}

## Add Wise Saying

<mark style="color:green;">`POST`</mark> `https://Random-Motivation-Wise-saying/myWiseSayings/:userId/:wiseSayingId`

#### Request Body

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| user\_id | String |             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "Add success"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "이미 존재합니"
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```javascript
{
    "Server error"
}
```

{% endtab %}
{% endtabs %}

## Delete Wise Saying

<mark style="color:red;">`DELETE`</mark> `https://Random-Motivation-Wise-saying/myWiseSayings/:userId/:wiseSayingId`

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "Delete Success"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "존재하지 않습니다"
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```javascript
{
    "Server error"
}
```

{% endtab %}
{% endtabs %}

## Change User Info

<mark style="color:purple;">`PATCH`</mark> `https://Random-Motivation-Wise-saying/users/:userId`

#### Request Body

| Name     | Type   | Description  |
| -------- | ------ | ------------ |
| name     | String | new name     |
| password | String | new password |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "Change successed"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "Unexpected name or password"
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```javascript
{
    "Server error"
}
```

{% endtab %}
{% endtabs %}

## Change myWiseSaying

<mark style="color:purple;">`PATCH`</mark> `https://Random-Motivation-Wise-saying/myWiseSayings/:userId/:wiseSayingId`

#### Request Body

| Name   | Type   | Description |
| ------ | ------ | ----------- |
| script | String |             |
| talker | String |             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "Change Success"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "Bad Request"
}
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```javascript
{
    "Server error"
}
```

{% endtab %}
{% endtabs %}
