// 게시글 전체 조회 요청 // 전체 게시글의 내용을 가져온다. 내용은 빼고 보내야 하나 고민중이다. - URL : '/api/articles' - Method : GET - Params : None - Body : None - Response : json - example : 'http://xpecter.shop/api/articles' // 특정 게시글 조회 요청 // 특정 게시물의 내용과 그에 딸린 댓글들을 가져온다. - URL : '/api/articles/:articleId' - Method : GET - Params : mongodb objectId(전체 조회시 아이디가 같이넘어감) - Body : None - Response : json - example : 'http://xpecter.shop/api/articles/620dd07fef0fa872a6256302' // 게시글 작성 요청 // 글 제목, 내용, 작성자만 보내면 DB에 넣는다. // articleCreateTime과 articleModifyTime을 현재 시각으로 넣는다. - URL : '/api/articles' - Method : POST - Params : None - Body : { articleTitle : String, // 글 제목 articleContent : String, // 글 내용 articleWriter : String // 작성자 이름 } - Response : 성공시 status 201 { success : true } - example : 'http://xpecter.shop/api/articles - example body : { articleTitle : "게시글 제목입니다.", articleContent : "게시글 내용입니다.", articleWriter : "xpecter" } // 게시글 수정 요청 // 수정된 글 제목과 글 내용만 받으며, 지금은 articleWriter와 articleCreateTime을 바꾸게 하지 않는다. // articleModifyTime 을 업데이트 한다. - URL : '/api/articles/:articleId' - Method : PUT - Params : mongodb objectId - Body : { articleTitle : String, // 글 제목 articleContent : String // 글 내용 } - Response 성공시 status 200 { success : true } 실패시 status 400 { success : false, errorMessage : "존재하지 않는 게시글입니다." } - example : 'http://xpecter.shop/api/articles/620dd07fef0fa872a6256302' - example body { articleTitle : "수정된 글 제목입니다.", articleContent : "수정된 글 내용입니다." } // 게시글 삭제 요청 // 게시글 id로 삭제를 요청한다. - URL : '/api/articles/:articleId' - Method : DELETE - Params : mongodb objectId - Body : None - Response 성공시 status 200 { success : true } 실패시 status 400 { success : false, errorMessage : "존재하지 않는 게시글입니다." } // 특정 게시글 댓글 조회 // 게시글 id로 댓글 목록을 요청한다. // article컬렉션에서 조회한 뒤, 존재하는 게시글이면 comment컬렉션에서 조회한다. - URL : '/api/articles/:articleId/comments' - Method : GET - Params : mongodb objectId - Body : None - Response { comments : [ _id : "620b1d07ba557a7cb88881e6", articleId : "620b1d07ba557a7cb222207f" writer : "작성자1", content : "댓글1 내용입니다.", createTime : "2022-02-17 12:03:01", modifyTime : "2022-02-17 15:44:02", ] } // 댓글 작성 // 게시글 id로 댓글 목록을 요청한다. // article컬렉션에서 조회한 뒤, 존재하는 게시글이면 comment컬렉션에서 조회한다. - URL : '/api/articles/:articleId/comments' - Method : POST - Params : mongodb objectId - Body : { "content" : "댓글 내용 1", "writer" : "댓글 작성자1" } - Response 성공시 status 201 { success : true } 실패시 status 400 { success : false, errorMessage : "존재하지 않는 게시글입니다." } // 게시글이 없을 때 { success : false, errorMessage : "TypeError" } // objectId가 형식에 맞지 않을 때 { success : false, errorMessage : "댓글 내용을 입력해주세요." } // 댓글 내용이 없을 때 // 댓글 수정 // 게시글 id로 댓글 목록을 요청한다. // article컬렉션에서 조회한 뒤, 존재하는 게시글이면 comment컬렉션에서 조회한다. - URL : '/api/articles/:articleId/comments/:commentId' - Method : PUT - Params articleId : mongodb objectId commentId : mongodb objectId - Body : { "content" : "수정된 댓글 내용 1", } - Response 성공시 status 200 { success : true } 실패시 status 400 { success : false, errorMessage : "존재하지 않는 게시글입니다." } // 게시글이 없을 때 { success : false, errorMessage : "TypeError" } // objectId가 형식에 맞지 않을 때 { success : false, errorMessage : "댓글 내용을 입력해주세요." } // 댓글 내용이 없을 때 // 댓글 삭제 // 게시글 id로 댓글 목록을 요청한다. // article컬렉션에서 조회한 뒤, 존재하는 게시글이면 comment컬렉션에서 조회한다. - URL : '/api/articles/:articleId/comments/:commentId' - Method : DELETE - Params articleId : mongodb objectId commentId : mongodb objectId - Body : None - Response 성공시 status 200 { success : true } 실패시 status 400 { success : false, errorMessage : "존재하지 않는 댓글입니다." } // 댓글이 없을 때 { success : false, errorMessage : "TypeError" } // objectId가 형식에 맞지 않을 때