6.1 좋아요
API
POST /post/:post_id/heart
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
{
"post": {
"id": String,
"content": String,
"createdAt": String,
"updatedAt": String,
"hearted": true,
"heartCount": 1,
"commentCount": 0,
"author": {
"_id": "작성자 id",
"username": "2",
"accountname": "2",
"intro": "2",
"image": "2",
"following": [],
"follower": [
"팔로워 한 사용자의 id"
],
"followerCount": 1,
"followingCount": 0
}
}
}
// FAIL
// 게시글이 존재하지 않을 때
존재하지 않는 게시글입니다.
JSON
복사
6.2 좋아요 취소
API
DELETE /post/:post_id/unheart
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
{
"post": {
"id": "61c0252b8ec189519824a9b1",
"content": "2@naver.com",
"createdAt": "2021-12-20T06:39:39.929Z",
"updatedAt": "2021-12-20T08:05:12.727Z",
"hearted": false,
"heartCount": 0,
"commentCount": 0,
"author": {
"_id": "작성자 id",
"username": "2",
"accountname": "2",
"intro": "2",
"image": "2",
"following": [],
"follower": [
"팔로워 한 사용자의 id"
],
"followerCount": 1,
"followingCount": 0
}
}
}
// FAIL
// 게시글이 존재하지 않을 때
존재하지 않는 게시글입니다.
JSON
복사