강의 있는 패캠 아이디 : yeongbin6####@gmail.com
Redis Version
docker ps
docker exec -it myredis bash
redis-cli
info
redis_version:7.0.4
MySQL Version
docker exec -it mysql-container bash
mysql --version
mysql version : 8.1.0
1. 회원가입
POST : http://127.0.0.1:9090/api/v1/users/join
Header
Content-Type : application/json
BODY
{
"name":"ccc",
"password":"bbb"
}
RESPONSE
{
"resultCode": "SUCCESS",
"result": {
"id": 1,
"userName": "ccc",
"userRole": "USER"
}
}
2. 로그인
POST : http://127.0.0.1:9090/api/v1/users/login
Header
Content-Type : application/json
BODY
{
"name":"ccc",
"password":"bbb"
}
RESPONSE
{
"resultCode": "SUCCESS",
"result": {
"token": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImNjYyIsImlhdCI6MTcwMzg5NTc3OCwiZXhwIjoxNzA2NDg3Nzc4fQ.yAwgi7mNRZGPAurj7SewQ3eH5RLfU3nvaYMa3MQ9MXM"
}
}
3. 포스트 등록
POST : http://127.0.0.1:9090/api/v1/posts
Header
Content-Type : application/json
Authorization : Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImNjYyIsImlhdCI6MTcwMzg5NTc3OCwiZXhwIjoxNzA2NDg3Nzc4fQ.yAwgi7mNRZGPAurj7SewQ3eH5RLfU3nvaYMa3MQ9MXM
BODY
{
"name":"ccc",
"title":"title",
"body":"body"
}
RESPONSE
{
"resultCode": "SUCCESS",
"result": null
}
4. 포스트 수정
PUT : http://127.0.0.1:9090/api/v1/users/join
Header
Content-Type : application/json
Authorization : Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImNjYyIsImlhdCI6MTcwMzg5NTc3OCwiZXhwIjoxNzA2NDg3Nzc4fQ.yAwgi7mNRZGPAurj7SewQ3eH5RLfU3nvaYMa3MQ9MXM
BODY
{
"title":"modified title",
"body":"modified body"
}
RESPONSE
{
"resultCode": "SUCCESS",
"result": {
"id": 1,
"title": "modified title",
"body": "modified body",
"user": {
"id": 1,
"userName": "ccc",
"role": "USER"
},
"registeredAt": "2023-12-30T00:25:24.782+00:00",
"updatedAt": "2023-12-30T00:26:07.710+00:00",
"deletedAt": null
}
}
5. 포스트 삭제
DELETE : http://127.0.0.1:9090/api/v1/posts/1
Header
Authorization : Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImNjYyIsImlhdCI6MTcwMzg5NTc3OCwiZXhwIjoxNzA2NDg3Nzc4fQ.yAwgi7mNRZGPAurj7SewQ3eH5RLfU3nvaYMa3MQ9MXM
BODY
RESPONSE
{
"resultCode": "SUCCESS",
"result": null
}
6. 피드 조회
GET: http://127.0.0.1:9090/api/v1/posts/my?page=0&size=5
Header
Authorization : Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImNjYyIsImlhdCI6MTcwMzg5NTc3OCwiZXhwIjoxNzA2NDg3Nzc4fQ.yAwgi7mNRZGPAurj7SewQ3eH5RLfU3nvaYMa3MQ9MXM
BODY
RESPONSE
{
"resultCode": "SUCCESS",
"result": {
"content": [
],
"pageable": {
"sort": {
"empty": true,
"sorted": false,
"unsorted": true
},
"offset": 0,
"pageSize": 5,
"pageNumber": 0,
"unpaged": false,
"paged": true
},
"last": true,
"totalElements": 0,
"totalPages": 0,
"size": 5,
"number": 0,
"sort": {
"empty": true,
"sorted": false,
"unsorted": true
},
"first": true,
"numberOfElements": 0,
"empty": true
}
}
7. 좋아요 기능
POST : http://127.0.0.1:9090/api/v1/posts/2/likes
Header
Content-Type : application/json
Authorization : Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImNjYyIsImlhdCI6MTcwMzg5NTc3OCwiZXhwIjoxNzA2NDg3Nzc4fQ.yAwgi7mNRZGPAurj7SewQ3eH5RLfU3nvaYMa3MQ9MXM
BODY
RESPONSE
{
"resultCode": "SUCCESS",
"result": null
}
8. 좋아요 개수 조회
GET: http://127.0.0.1:9090/api/v1/posts/2/likes
Header
Content-Type : application/json
BODY
RESPONSE
{
"resultCode": "SUCCESS",
"result": 1
}
9. 코멘트 생성
POST : http://127.0.0.1:9090/api/v1/posts/2/comments
Header
Content-Type : application/json
BODY
{
"comment":"second comment"
}
RESPONSE
{
"resultCode": "SUCCESS",
"result": null
}
10. 코멘트 조회
GET: http://127.0.0.1:9090/api/v1/posts/2/comments
Header
Content-Type : application/json
BODY
{
"name":"ccc",
"password":"bbb"
}
RESPONSE
{
"resultCode": "SUCCESS",
"result": {
"content": [
{
"id": 1,
"comment": "second comment",
"userName": "ccc",
"postId": 2,
"registeredAt": "2023-12-30T00:32:24.529+00:00",
"updatedAt": null,
"deletedAt": null
}
],
"pageable": {
"sort": {
"empty": true,
"sorted": false,
"unsorted": true
},
"offset": 0,
"pageSize": 20,
"pageNumber": 0,
"unpaged": false,
"paged": true
},
"last": true,
"totalElements": 1,
"totalPages": 1,
"size": 20,
"number": 0,
"sort": {
"empty": true,
"sorted": false,
"unsorted": true
},
"first": true,
"numberOfElements": 1,
"empty": false
}
}
11. 알람 조회
POST : http://127.0.0.1:9090/api/v1/users/join
Header
Content-Type : application/json
BODY
{ "name":"ccc", "password":"bbb"}
RESPONSE
'sns' 카테고리의 다른 글
API / JPA 로직 별 실행되는 쿼리 확인 (0) | 2024.01.04 |
---|---|
서버 부팅 시 Table 자동 생성되는 Hibernate 쿼리 기록 (0) | 2024.01.04 |
댓글