소개
게시글
질문&답변
2020.04.18
질문입니다.
오타군요ㅠㅠㅠㅠ 감사합니다ㅠㅠ 잘 친다고 쳤는데ㅠㅠ 정말 감사합니다
- 0
- 6
- 4.9K
질문&답변
2020.04.17
질문입니다.
저 완전히 똑같은 오류인데 어떻게 해결 할 수 있을까요? 제로초님 말씀대로 이 부분에서 ...이 에러가 맞는데 해결방법을 모르겠습니다ㅠㅠ post.Comments가 undefined가 나와요ㅠㅠ 참고로 디비 확인했을때 댓글들이 잘 들어가 있습니다 const Comments = [ ... post . Comments , action . data . comment ];
- 0
- 6
- 4.9K
질문&답변
2020.04.17
포스트가 존재하지 않습니다 에러가 납니다ㅠㅜㅠ
해결되었어요!! 감사합니다!!!!
- 0
- 5
- 128
질문&답변
2020.04.17
포스트가 존재하지 않습니다 에러가 납니다ㅠㅜㅠ
if문을 지우고 실행했더니 id 가 null이라고 나옵니다. 혹시 디비 자체에서 문제가 발생한 걸까요??
- 0
- 5
- 128
질문&답변
2020.04.17
포스트가 존재하지 않습니다 에러가 납니다ㅠㅜㅠ
콘솔창에러메세지와 POST http://localhost:3065/api/post/$%7Bdata.postId%7D/comment 404 (Not Found) 코드입니다 router . post ( '/:id/comment' , async ( req , res , next ) => { try { if ( ! req .user) { return res . status ( 401 ). send ( '로그인이 필요합니다.' ) ; } const post = await db . Post . findOne ( { where : { id : req . params . id } } ) ; if ( ! post) { return res . status ( 404 ). send ( '포스트가 존재하지 않습니다.' ) ; } const newComment = await db . Comment . create ( { PostId : post . id , UserId : req . user . id , content : req . body . content , } ) ; await post . addComment ( newComment . id ) ; const comment = await db . Comment . findOne ( { where : { id : newComment . id , } , include :[ { model : db .User, attributes :[ 'id' , 'nickname' ], } ], } ) ; return res . json (comment) ; } catch (e) { console . error (e) ; return next (e) ; } } ) ; network의 response 메세지 입니다 포스트가 존재하지 않습니다.
- 0
- 5
- 128