🖥️게시물 CRUD API
게시물 작성 API
POST localhost:3000/api/posts
Request Body
Name
Type
Description
title*
string
title of the post
content*
string
content of the post
{
message:"게시물 작성에 성공하였습니다."
}{
errorMessage:"게시물 작성에 실패하였습니다."
}{
errorMessage:"미입력된 항목이 있습니다. 모두 입력하여 주세요."
}게시물 전체 조회 API
GET localhost:3000/api/posts
{ posts }
{
message:"게시물이 없습니다. 첫 작성자가 되어 주세요."
}{
errorMessage:"게시물 조회에 실패하였습니다."
}게시물 상세 조회 API
GET localhost:3000/api/posts/:postId
Path Parameters
Name
Type
Description
postId*
String
postId of the post
{
post
}{
errorMessage:"게시물 상세 조회에 실패하였습니다."
}게시물 수정 API
PATCH localhost:3000/api/posts/:postId
Path Parameters
Name
Type
Description
postId*
String
postId of the post
Request Body
Name
Type
Description
title*
String
title of the post
content*
String
content of the post
{
message:"게시물 수정에 성공하였습니다."
}{
errorMessage:"게시물 수정에 실패하였습니다. 모든 항목을 입력해 주세요."
}{
errorMessage:"게시물 수정에 실패하였습니다."
}게시물 삭제 API
DELETE localhost:3000/api/posts/:postId
Path Parameters
Name
Type
Description
postId*
String
postId of the post
{
message:"게시물 삭제에 성공하였습니다."
}{
errorMessage:"게시물 삭제에 실패하였습니다."
}{
errorMessage:"미입력된 항목이 있습니다. 모든 항목을 입력해 주세요."
}Last updated