# Board

## 게시글 생성

## create board

<mark style="color:green;">`POST`</mark> `boards/`

새 게시판을 만듭니다.

#### Request Body

| Name                                      | Type   | Description                                                                         |
| ----------------------------------------- | ------ | ----------------------------------------------------------------------------------- |
| title<mark style="color:red;">\*</mark>   | string | <p>게시물의 제목을 입력합니다.</p><p>제목은 Null, Blank값이 올 수 없으며 최소 1글자 이상 15글자 이하로 구성해야 합니다.</p> |
| content<mark style="color:red;">\*</mark> | string | <p>게시물의 내용을 입력합니다.</p><p>내용은 Null값이 올 수 없으며, 1글자 이상 1000글자 이하로 구성해야 합니다.</p>        |

{% tabs %}
{% tab title="201: Created 게시판이 성공적으로 만들어졌습니다." %}

```json
{
    "id": int,
    "title": "제목",
    "content": "내용",
    "createAt": "2023-05-22T04:53:17.2417056"
}
```

{% endtab %}

{% tab title="500: Internal Server Error 서버에 문제가 생겼습니다." %}

{% endtab %}

{% tab title="400: Bad Request 제목을 무조껀 입력해야 합니다." %}

```json
{
    "status": "400",
    "message": "제목을 무조껀 입력해야 합니다."
}
```

{% endtab %}

{% tab title="400: Bad Request 제목은 1글자 이상 15글자 이하로 구성해야 합니다." %}

```json
{
    "status": "400",
    "message": "제목은 1글자 이상 15글자 이하로 구성해야 합니다."
}
```

{% endtab %}

{% tab title="400: Bad Request 제목에 공백이 올 수 없습니다." %}

```json
{
    "status": "400",
    "message": "제목에 공백이 올 수 없습니다."
}
```

{% endtab %}

{% tab title="400: Bad Request 내용을 무조껀 입력해야 합니다." %}

```json
{
    "status": "400",
    "message": "내용을 무조껀 입력해야 합니다."
}
```

{% endtab %}

{% tab title="400: Bad Request 내용은 1글자 이상 1000글자 이하로 구성해야 합니다." %}

```json
{
    "status": "400",
    "message": "내용은 1글자 이상 1000글자 이하로 구성해야 합니다."
}
```

{% endtab %}
{% endtabs %}

## 게시글 전체 조회

## find boards all

<mark style="color:blue;">`GET`</mark> `boards/`

모든 게시물을 조회합니다.

#### Query Parameters

| Name                                   | Type | Description           |
| -------------------------------------- | ---- | --------------------- |
| page<mark style="color:red;">\*</mark> | int  | 조회하고 싶은 페이지 수를 입력합니다. |

{% tabs %}
{% tab title="200: OK 전제 조회 결과 반환" %}
전체 페이지 수와 현재 페이지 수, 그리고 페이지 안에 있는 게시물의 정보를 반환합니다.

````
{
    "boardResponseDtos": [
        {
            "id": 6,
            "title": "6 게시물",
            "content": "6 내용",
            "createAt": "2023-05-22T04:53:17"
        },
        {
            "id": 5,
            "title": "5 게시물",
            "content": "5 내용",
            "createAt": "2023-05-18T03:49:03"
        },
        {
            "id": 1,
            "title": "1 게시물",
            "content": "1 내용",
            "createAt": "2023-05-15T16:31:08"
        }
    ],
    "totalPages": 1,
    "offset": 0
}
```
````

만일 게시물이 없다면 빈 공간을반환합니다.
{% endtab %}
{% endtabs %}

## 특정 게시글 조회

## find board

<mark style="color:blue;">`GET`</mark> `boards/id`

특정 게시물을 id 값으로 조회합니다.

#### Path Parameters

| Name                                 | Type | Description               |
| ------------------------------------ | ---- | ------------------------- |
| id<mark style="color:red;">\*</mark> | int  | 조회하고 싶은 게시물의 id 값을 입력합니다. |

{% tabs %}
{% tab title="200: OK id 값에 맞는 게시물 정보를 반환합니다." %}

```json
{
    "id": 1,
    "title": "1 게시물",
    "content": "1 내용",
    "createAt": "2023-05-15T16:31:08"
}
```

{% endtab %}

{% tab title="404: Not Found id 값에 맞는 게시물이 존재하지 않습니다." %}

```json
{
    "status": "404",
    "message": "게시판을 찾을 수 없습니다."
}
```

{% endtab %}
{% endtabs %}

## 특정 게시글 수정

## update board

<mark style="color:blue;">`GET`</mark> `boards/id`

id로 조회한 특정 게시글의 제목과 내용을 수정합니다.

#### Path Parameters

| Name                                 | Type | Description               |
| ------------------------------------ | ---- | ------------------------- |
| id<mark style="color:red;">\*</mark> | int  | 수정하고 싶은 게시글의 id 값을 입력합니다. |

#### Request Body

| Name                                    | Type   | Description                                        |
| --------------------------------------- | ------ | -------------------------------------------------- |
| title<mark style="color:red;">\*</mark> | String | <p>제목을 입력합니다.</p><p>게시물 생성과 동일한 유효성 검사를 진행합니다.</p> |
| content                                 | String | <p>내용을 입력합니다.</p><p>게시물 생성과 동일한 유효성 검사를 진행합니다.</p> |

{% tabs %}
{% tab title="200: OK 수정된 게시글을 반환합니다." %}

```json
{
    "id": 2,
    "title": "2 제목 수정",
    "content": "2 내용 수정",
    "createAt": "2023-05-15T16:31:15"
}
```

{% endtab %}

{% tab title="404: Not Found id 값에 맞는 게시물이 존재하지 않습니다." %}
특정 게시글 조회 기능의 404 에러와 동일한 에러 응답을 반환합니다.
{% endtab %}

{% tab title="400: Bad Request 제목 및 내용의 유효성 검사에 어긋납니다." %}
게시물 생성과 동일한 유효성 검사를 진행하며, 동일한 에러 응답을 반환합니다.
{% endtab %}
{% endtabs %}

## 특정 게시글 삭제 기능

## delete board

<mark style="color:red;">`DELETE`</mark> `boards/id`

id로 조회한 특정 게시글을 삭제합니다.

#### Path Parameters

| Name                                 | Type | Description           |
| ------------------------------------ | ---- | --------------------- |
| id<mark style="color:red;">\*</mark> | int  | 삭제할 게시글의 id 값을 입력합니다. |

{% tabs %}
{% tab title="200: OK 성공적으로 제거하였습니다." %}

```
성공적으로 제거했습니다.
```

{% endtab %}

{% tab title="404: Not Found id값에 맞는 게시글을 찾을 수 없습니다." %}
특정 게시글 조회의 404 에러와 동일한 에러 응답을 반환합니다.
{% endtab %}
{% endtabs %}

## 게시글 검색 기능

## search board

<mark style="color:blue;">`GET`</mark> `boards/search`

제목에 keyword가 포함된 게시글을 조회합니다.

#### Query Parameters

| Name                                      | Type   | Description        |
| ----------------------------------------- | ------ | ------------------ |
| keyword<mark style="color:red;">\*</mark> | string | 검색할 키워드를 입력해야 합니다. |
| page<mark style="color:red;">\*</mark>    | int    | 원하는 페이지를 입력합니다.    |

{% tabs %}
{% tab title="200: OK 키워드가 포함된 제목을 가진 게시글 리스트를 반환합니다." %}

```json
{
    "boardResponseDtos": [
        {
            "id": 2,
            "title": "2 제목 수정",
            "content": "2 내용 수정",
            "createAt": "2023-05-15T16:31:15"
        }
    ],
    "totalPages": 1,
    "offset": 0
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jscode.gitbook.io/jscode/reference/api-reference/board.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
