게시판에서 관련된 로직들을 구현한 API 입니다.
- Java 17
- Spring Boot 3.4.1
- Spring Boot Data JPA
- Redis
- MySQL
- Git
회원 인증
뒷배 게시판에 회원가입과 로그인을 할수 있습니다
POST
요청을 사용해서 새 계정정보를 등록할 수 있습니다.
Path | Type | Description |
---|---|---|
username |
String |
유저ID |
password |
String |
비밀번호 |
passwordCheck |
String |
비밀번호 확인 |
name |
String |
유저닉네임 |
POST http://localhost:8080/session/join
Content-Type: application/json
{
"username": "string",
"password": "string",
"passwordCheck": "string",
"name": "string"
}
HTTP/1.1 201
회원 가입이 완료되었습니다.
POST
요청을 사용해서 로그인이 가능합니다.
로그인에 성공하면 세션을 얻습니다.
Path | Type | Description |
---|---|---|
username |
String |
유저ID |
password |
String |
비밀 번호 |
POST http://localhost:8080/session/login
Content-Type: application/json
{
"username": "string",
"password": "string"
}
HTTP/1.1 200
로그인 성공
POST
요청을 사용해서 로그아웃이 가능합니다.
POST http://localhost:8080/session/logout
Content-Type: application/json
HTTP/1.1 200
로그아웃 성공
게시물 관리
뒷배 게시판에 게시물 작성 및 수정,삭제와 상세를 보거나 리스트로 볼수 있습니다.
POST
요청을 사용해서 새 게시물을 등록할수 있습니다.
유저 닉네임과 작성 시간은 자동으로 등록되며
카테고리 번호는 QUESTION(1), INFORMATION(2),HUMOR(3), FREE(4) 입니다.
Path | Type | Description |
---|---|---|
title |
String |
게시물 제목 |
content |
String |
게시물 내용 |
category_id |
Int |
카테고리 번호 |
POST http://localhost:8080/post
Content-Type: application/json
{
"title": "string",
"content": "string",
"category_id": "1"
}
HTTP/1.1 201
게시물 작성을 성공하였습니다
DELETE
요청을 사용해서 게시물 번호에 맞는 게시물을 삭제합니다.
DELETE http://localhost:8080/post/{post_id}
Content-Type: application/json
HTTP/1.1 204
게시물 삭제를 삭제를 성공하였습니다.
PATCH
요청을 사용해서 게시물 수정을 할수 있습니다.
카테고리와 콘텐츠, 카테고리를 수정할수 있습니다.
Path | Type | Description |
---|---|---|
title |
String |
게시물 제목 |
content |
String |
게시물 내용 |
category_id |
Int |
카테고리 번호 |
PATCH http://localhost:8080/post
Content-Type: application/json
{
"title": "string",
"content": "string",
"category_id": "1"
}
HTTP/1.1 200
게시물 수정을 성공하였습니다.
GET
요청을 사용해서 게시물 상세정보와 달린 댓글을 봅니다.
GET http://localhost:8080/post/view/{post_id}
Content-Type: application/json
Path | Type | Description |
---|---|---|
id |
Long |
게시물 아이디 |
title |
String |
게시물 제목 |
content |
String |
게시물 내용 |
name |
String |
작성 유저 닉네임 |
category_id |
int |
카테고리 번호 |
create_date |
LocalDateTime |
작성시간 |
Path | Type | Description |
---|---|---|
id |
Long |
댓글 아이디 |
content |
String |
댓글 내용 |
memberId |
Long |
작성 유저 아이디 |
postId |
Long |
게시물 아이디 |
HTTP/1.1 200
{
"id": 0,
"title": "string",
"content": "string",
"name": "string",
"category_id": "QUESTION",
"create_date": "2025-01-06T02:33:07.759Z",
"comments": [
{
"id": 0,
"content": "string",
"memberId": 0,
"postId": 0
}
]
}
GET
요청을 사용해서 게시물 목록을 원하는 정렬방식으로 봅니다.
keyword (string, optional): 검색 키워드.
category (string, optional): 게시물 카테고리 ID.
page (integer, optional): 페이지 번호 (기본값: 1).
size (integer, optional): 페이지 크기 (기본값: 20).
sort (string, optional): 정렬 기준 (예: create_date,asc).
GET http://localhost:8080/post/list?keword={keyword}
&category={category}
&page={page}
&size={size}
&sort={sort}
Content-Type: application/json
Path | Type | Description |
---|---|---|
totalPages |
int |
전체 페이지 수 |
totalElements |
int |
전체 요소 수 |
first |
boolean |
첫 번째 페이지 여부 |
last |
boolean |
마지막 페이지 여부 |
size |
int |
페이지당 요소 수 |
number |
int |
현재 페이지 번호 |
numberOfElements |
int |
현재 페이지의 요소 수 |
empty |
boolean |
콘텐츠가 비어있는지 여부 |
content |
List<Content> |
게시물 목록 |
sort |
Sort |
정렬 정보 |
pageable |
Pageable |
페이징 정보 |
Path | Type | Description |
---|---|---|
create_date |
String (ISO 8601) |
작성일자 |
post_id |
int |
게시물 ID |
name |
String |
작성자 닉네임 |
title |
String |
게시물 제목 |
content |
String |
게시물 내용 |
Path | Type | Description |
---|---|---|
empty |
boolean |
정렬 정보가 비어있는지 여부 |
unsorted |
boolean |
정렬되지 않았는지 여부 |
sorted |
boolean |
정렬되었는지 여부 |
Path | Type | Description |
---|---|---|
offset |
int |
페이지의 오프셋 |
sort |
Sort |
정렬 정보 |
pageSize |
int |
페이지당 요소 수 |
pageNumber |
int |
현재 페이지 번호 |
paged |
boolean |
페이징 여부 |
unpaged |
boolean |
페이징이 적용되지 않았는지 여부 |
Path | Type | Description |
---|---|---|
empty |
boolean |
정렬 정보가 비어있는지 여부 |
unsorted |
boolean |
정렬되지 않았는지 여부 |
sorted |
boolean |
정렬되었는지 여부 |
HTTP/1.1 200
{
"totalPages": 0,
"totalElements": 0,
"first": true,
"last": true,
"size": 0,
"content": [
{
"create_date": "2025-01-06T03:51:37.675Z",
"post_id": 0,
"name": "string",
"title": "string",
"content": "string"
}
],
"number": 0,
"sort": {
"empty": true,
"unsorted": true,
"sorted": true
},
"numberOfElements": 0,
"pageable": {
"offset": 0,
"sort": {
"empty": true,
"unsorted": true,
"sorted": true
},
"pageSize": 0,
"pageNumber": 0,
"paged": true,
"unpaged": true
},
"empty": true
}
댓글 관리
뒷배 게시판에 댓글 작성 및 수정, 삭제를 합니다.
POST
요청을 사용해서 새 댓글을 등록합니다.
Path | Type | Description |
---|---|---|
id |
Long |
댓글 아이디 |
content |
String |
댓글 내용 |
memberId |
Long |
멤버 아이디 |
postId |
Long |
게시물 아이디 |
POST http://localhost:8080/comment
Content-Type: application/json
{
"id": 0,
"content": "string",
"memberId": 0,
"postId": 0
}
HTTP/1.1 201
댓글 작성을 성공하였습니다
PATCH
요청을 사용해서 댓글 수정을 할수 있습니다.
멤버 아이디와 게시물 아이디는 원본 댓글과 똑같이 넣어야 합니다.
Path | Type | Description |
---|---|---|
id |
Long |
댓글 아이디 |
content |
String |
댓글 내용 |
memberId |
Long |
멤버 아이디 |
postId |
Long |
게시물 아이디 |
PATCH http://localhost:8080/comment/{comment_id}
Content-Type: application/json
{
"id": 0,
"content": "string",
"memberId": 0,
"postId": 0
}
HTTP/1.1 200
댓글 수정을 성공하였습니다.
DELETE
요청을 사용해서 댓글을 삭제합니다.
DELETE http://localhost:8080//comment/{comment_id}
Content-Type: application/json
HTTP/1.1 204
댓글 삭제를 성공하였습니다.
회원 정보 관리
뒷배 게시판에 가입한 유저의 회원 정보 조회와 수정이 가능합니다.
GET
요청을 사용해서 게시물 상세정보와 달린 댓글을 봅니다.
현재 세션의 유저와 요청한 유저가 다를경우 403에러가 발생합니다.
GET http://localhost:8080/post/view/{post_id}
Content-Type: application/json
Path | Type | Description |
---|---|---|
id |
Long |
유저 번호 |
username |
String |
유저 아이디 |
user_role |
String |
유저 권한 |
name |
String |
유저 닉네임 |
HTTP/1.1 200
{
"id": 0,
"username": "string",
"user_role": "USER",
"name": "string"
}
PATCH
요청을 사용해서 닉네임과 비밀번호 수정을 할 수 있습니다.
Path | Type | Description |
---|---|---|
password |
String |
회원 비밀번호 |
name |
String |
회원 닉네임 |
PATCH http://localhost:8080/member/{id}
Content-Type: application/json
{
"password": "string",
"name": "string"
}
GET
요청을 사용해서 현재 회원의 작성한 게시글과 댓글을 봅니다.
GET http://localhost:8080/member/{id}/activity
Content-Type: application/json
Path | Type | Description |
---|---|---|
postId |
Long |
게시물 ID |
title |
String |
게시물 제목 |
content |
String |
게시물 내용 |
category |
String |
게시물 카테고리 |
createdDate |
LocalDateTime |
게시물 작성일자 |
Path | Type | Description |
---|---|---|
commentId |
Long |
댓글 ID |
content |
String |
댓글 내용 |
postId |
Long |
연관된 게시물 ID |
HTTP/1.1 200 OK
{
"posts": [
{
"postId": 0,
"title": "string",
"content": "string",
"category": "string",
"createdDate": "2025-01-06T06:46:00.209Z"
}
],
"comments": [
{
"commentId": 0,
"content": "string",
"postId": 0
}
]
}