> For the complete documentation index, see [llms.txt](https://undefined-296.gitbook.io/communitrip/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/communitrip/communitrip.md).

# Communitrip

API documents for Random-Motivation-Wise-saying

## 유저 정보

<mark style="color:blue;">`GET`</mark> `https://communitrip.com/users/:userId`

#### Path Parameters

| Name                                       | Type | Description |
| ------------------------------------------ | ---- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | int  |             |

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

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

{% endtab %}

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

```javascript
{
    "먼저 로그인 하세요"
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 회원가입

<mark style="color:green;">`POST`</mark> `https://communitrip.com/users/signup`

#### Request Body

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

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

```javascript
{
    "회원가입 성공했습니다"
}
```

{% endtab %}

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

```javascript
{
    "이미 존재하는 유저입니다"
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 회원정보 수정

<mark style="color:purple;">`PATCH`</mark> `https://communitrip.com/users/:userId`

#### Request Body

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| username      | string |             |
| password      | string |             |
| user\_id      | int    |             |
| user\_profile | string |             |

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

```javascript
{
    “수정 완료”
}
```

{% endtab %}

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

```javascript
{
    “잘못 적으셨네요”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 로그인

<mark style="color:green;">`POST`</mark> `https://communitrip.com/users/login`

#### Request Body

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

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

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

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    “잘못 적으셨네요”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 로그아웃

<mark style="color:green;">`POST`</mark> `https://communitrip.com/users/logout`

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

```javascript
{
    “로그아웃 성공”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 회원탈퇴

<mark style="color:red;">`DELETE`</mark> `https://communitrip.com/users/:userId`

#### Headers

| Name                                       | Type | Description |
| ------------------------------------------ | ---- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | int  |             |

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

```javascript
{
    “회원탈퇴 성공”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 게시글 전체

<mark style="color:blue;">`GET`</mark> `https://communitrip.com/posts`

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

```javascript
{
    {
    “id”: “1”,
    "user_id": "1",
    “title”: “한라산”,
    “script”: “한라산은 제주도에서 가장 높은 산입니다”,
    “picture”: "https://api.cdn.visitjeju.net/photomng/imgpath/201911/29/13775f73-45ef-494f-bc15-7d78756284e7.jpg",
    “total_likes”: “13”,
    },
    {
    “id”: “2”,
    "user_id": "2",
    “title”: “전주 한옥 마을”,
    “script”: “전주 한옥 마을은 전통가옥으로 구성된 마을입니다”,
    “picture”: "http://hanok.jeonju.go.kr/assets/images/contents/tour/info-main-img2.gif",
    “total_likes”: “27”,
    },
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 나의 게시글 전체

<mark style="color:blue;">`GET`</mark> `https://communitrip.com/posts/users/:userId`

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

```javascript
{
    {
    “id”: “1”,
    "user_id": "1",
    “title”: “한라산”,
    “script”: “한라산은 제주도에서 가장 높은 산입니다”,
    “picture”: "https://api.cdn.visitjeju.net/photomng/imgpath/201911/29/13775f73-45ef-494f-bc15-7d78756284e7.jpg",
    “total_likes”: “13”,
    },
    {
    “id”: “2”,
    "user_id": "2",
    “title”: “전주 한옥 마을”,
    “script”: “전주 한옥 마을은 전통가옥으로 구성된 마을입니다”,
    “picture”: "http://hanok.jeonju.go.kr/assets/images/contents/tour/info-main-img2.gif",
    “total_likes”: “27”,
    },
}
```

{% endtab %}

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

```javascript
{
    “좋아요 누른 게시물이 없어요”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 게시글 하나

<mark style="color:blue;">`GET`</mark> `https://communitrip.com/posts/:postId`

#### Path Parameters

| Name                                       | Type | Description |
| ------------------------------------------ | ---- | ----------- |
| post\_id<mark style="color:red;">\*</mark> | int  |             |

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

```javascript
{
    {
    “id”: “1”,
    "user_id": "1",
    “title”: “한라산”,
    “script”: “한라산은 제주도에서 가장 높은 산입니다”,
    “image”: "https://api.cdn.visitjeju.net/photomng/imgpath/201911/29/13775f73-45ef-494f-bc15-7d78756284e7.jpg    ",
    “total_likes”: “13”,
    "comments": {
    {
        "comment": “짱이네요”,
        "comment_user_id": "2"
        }, {
        "comment": “멋져요”,
        "comment_user_id": "3"
        }
    }
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 게시글 생성

<mark style="color:green;">`POST`</mark> `https://communitrip.com/posts/:userId`

#### Request Body

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| user\_id<mark style="color:red;">\*</mark> | int    |             |
| contents<mark style="color:red;">\*</mark> | string |             |
| title<mark style="color:red;">\*</mark>    | string |             |
| tag\_id<mark style="color:red;">\*</mark>  | int    |             |
| image<mark style="color:red;">\*</mark>    | string |             |

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

```javascript
{
    “게시글 완성!”
}
```

{% endtab %}

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

```javascript
{
    “내용이 없어요”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 게시판 태그 요청

<mark style="color:blue;">`GET`</mark> `https://communitrip.com/tags`

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

```javascript
{
    {
    “tag_id”: “1”,
    “tag_name: “강”,
    },
    {
    "tag_id": "2",
    "tag_name": "경기"
    },
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 게시글 삭제

<mark style="color:red;">`DELETE`</mark> `https://communitrip.com/posts/:postId`

#### Headers

| Name                                       | Type | Description |
| ------------------------------------------ | ---- | ----------- |
| post\_id<mark style="color:red;">\*</mark> | int  |             |
| user\_id<mark style="color:red;">\*</mark> | int  |             |

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

```javascript
{
    “게시글 삭제 성공”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}

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

```javascript
{
    “해당 게시물을 작성한 유저가 아닙니다”
}
```

{% endtab %}
{% endtabs %}

## 게시글 수정

<mark style="color:purple;">`PATCH`</mark> `https://communitrip.com/posts/:postId`

#### Request Body

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| post\_id<mark style="color:red;">\*</mark> | int    |             |
| contents<mark style="color:red;">\*</mark> | string |             |
| title<mark style="color:red;">\*</mark>    | string |             |
| tag\_id<mark style="color:red;">\*</mark>  | int    |             |
| image                                      | string |             |

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

```javascript
{
    “수정 완료”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 댓글 생성

<mark style="color:green;">`POST`</mark> `https://communitrip.com/posts/:postsId/comments`

#### Request Body

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| user\_id<mark style="color:red;">\*</mark> | int    |             |
| post\_id<mark style="color:red;">\*</mark> | int    |             |
| comment<mark style="color:red;">\*</mark>  | string |             |

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

```javascript
{
    “생성 완료”
}
```

{% endtab %}

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

```javascript
{
    “내용이 없어요”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    “로그인 정보가 없습니다”
}
```

{% endtab %}
{% endtabs %}

## 댓글 수정

<mark style="color:purple;">`PATCH`</mark> `https://communitrip.com/posts/:postsId/comments/:commentsId`

#### Request Body

| Name                                          | Type   | Description |
| --------------------------------------------- | ------ | ----------- |
| post\_id<mark style="color:red;">\*</mark>    | int    |             |
| comment<mark style="color:red;">\*</mark>     | string |             |
| comment\_id<mark style="color:red;">\*</mark> | int    |             |

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

```javascript
{
    “수정 완료”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 댓글 갱신

<mark style="color:blue;">`GET`</mark> `https://communitrip.com/posts/:postId/comments`

#### Path Parameters

| Name                                       | Type | Description |
| ------------------------------------------ | ---- | ----------- |
| post\_id<mark style="color:red;">\*</mark> | int  |             |

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

```javascript
{
    "comments": {
    {
        "comment": “짱이네요”,
        "comment_user_id": "2"
        }, {
        "comment": “멋져요”,
        "comment_user_id": "3"
        }
    }
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 댓글 삭제

<mark style="color:red;">`DELETE`</mark> `https://communitrip.com/posts/:postsId/comments/:commentsId`

#### Headers

| Name                                       | Type | Description |
| ------------------------------------------ | ---- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | int  |             |
| post\_id<mark style="color:red;">\*</mark> | int  |             |

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

```javascript
{
    “삭제 성공”
}
```

{% endtab %}

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

```javascript
{
    “해당 댓글 작성한 유저가 아닙니다”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 좋아요 증가

<mark style="color:green;">`POST`</mark> `https://communitrip.com/posts/:postsId/likes`

#### Request Body

| Name                                       | Type | Description |
| ------------------------------------------ | ---- | ----------- |
| user\_id<mark style="color:red;">\*</mark> | int  |             |
| post\_id<mark style="color:red;">\*</mark> | int  |             |

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

```javascript
{
    “종아요 개수 증가”
}
```

{% endtab %}

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

```javascript
{
    “로그인 먼저 하세요”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 좋아요 갱신

<mark style="color:blue;">`GET`</mark> `https://communitrip.com/posts/:postId/likes`

#### Path Parameters

| Name                                       | Type | Description |
| ------------------------------------------ | ---- | ----------- |
| post\_id<mark style="color:red;">\*</mark> | int  |             |

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

```javascript
{
    "id": "1",
    "total_likes": "13"
}
```

{% endtab %}

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

```javascript
{
    “로그인 먼저 하세요”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}

## 좋아요 취소

<mark style="color:red;">`DELETE`</mark> `https://communitrip.com/posts/:postsId/likes`

#### Headers

| Name                                       | Type | Description |
| ------------------------------------------ | ---- | ----------- |
| post\_id<mark style="color:red;">\*</mark> | int  |             |
| user\_id<mark style="color:red;">\*</mark> | int  |             |

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

```javascript
{
    “종아요 개수 감소”
}
```

{% endtab %}

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

```javascript
{
    "서버에 문제가 있네요"
}
```

{% endtab %}
{% endtabs %}
