7.1 댓글 작성
API
POST /post/:post_id/comments
JavaScript
복사
method, 전송 url
Req
{
"comment":{
"content":String
}
}
JSON
복사
body(json)
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
{
"comment": {
"id": Sting,
"content": Sting,
"createdAt": Sting,
"author": {
"_id": "작성자 id",
"username": "1",
"accountname": "1",
"intro": "1",
"image": "1",
"following": [],
"follower": [],
"followerCount": 0,
"followingCount": 0
}
}
}
// FAIL
// 게시물이 존재하지 않을 때
존재하지 않는 게시글입니다.
// 댓글을 입력하지 않을 때
댓글을 입력해주세요.
JSON
복사
7.2 댓글 리스트
API
// 기본값은 10개만 불러옵니다.
GET /post/:post_id/comments
// paging limit skip
GET /post/:post_id/comments/?limit=Number&skip=Number
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
// 댓글이 존재하는 경우
{
"comment": [
{
"id": String,
"content": String,
"createdAt": "2021-12-20T06:10:26.803Z",
"author": {
"_id": "작성자 id",
"username": "1",
"accountname": "1",
"intro": "1",
"image": "1",
"following": [],
"follower": [],
"followerCount": 0,
"followingCount": 0
}
}
]
}
// 댓글이 존재하지 않는 경우
{
"comment": []
}
// FAIL
// 게시물이 존재하지 않을 때
존재하지 않는 게시글입니다.
JSON
복사
7.3 댓글 삭제
API
DELETE /post/:post_id/comments/:comment_id
Plain Text
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
댓글이 삭제되었습니다.
// FAIL
// 게시글이 존재하지 않을 때
존재하지 않는 게시글입니다.
// 댓글이 존재하지 않을 때
댓글이 존재하지 않습니다.
JSON
복사
7.4 댓글 신고
API
POST /post/:post_id/comments/:comment_id/report
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
{
"report": {
"comment": "댓글 id"
}
}
// FAIL
// 게시글이 존재하지 않을 때
존재하지 않는 게시글입니다.
// 댓글이 존재하지 않을 때
댓글이 존재하지 않습니다.
JSON
복사