상황 정리
- 게시글을 저장하는 데이터베이스 생성 과정에서 SyntaxError 발생
- stackTrace를 확인해보니 require('./routes/post')를 가리키고 있어 post.js를 확인해보기로 함
- post.js에서 post를 생성하는 부분을 확인
=> content = req.body.content로 잘못 작성 되어 있어 수정
=> content : req.body.content로 수정하여 재실행해보니 정상 작동
오류 전문
C:\Users\insa8\Desktop\NodeProject\210112_Nodebird\routes\post.js:40
content = req.body.content,
^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Invalid shorthand property initializer
at wrapSafe (internal/modules/cjs/loader.js:992:16)
at Module._compile (internal/modules/cjs/loader.js:1040:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Module.require (internal/modules/cjs/loader.js:965:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\insa8\Desktop\NodeProject\210112_Nodebird\app.js:13:20)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
[nodemon] app crashed - waiting for file changes before starting...
'Node.js > BugReport' 카테고리의 다른 글
ValidationError [SequelizeValidationError]: notNull Violation (0) | 2021.01.16 |
---|