postman으로 post를 해봤을때도 그렇고 회원가입 버튼을 눌러도 작동이 되지 않고 'Fail to sign up'만 뜹니다. mongodb에서 collections 확인해봤는데 도착한 게 없는거로 봐서는 post 자체가 안 되는 것 같은데 어떻게 해야할 까요?? 코드는 변수명이나 디렉토리 이름정도 빼고는 강의랑 똑같이 한 거 같습니다. 엣지 검사기능에서 콘솔열어보면 아래처럼 오류가 떠요.
Uncaught (in promise) Error: Request failed with status code 500 at createError (createError.js:16) at settle (settle.js:17) at XMLHttpRequest.onloadend (xhr.js:66)
|
createError |
@ |
createError.js:16 |
|
settle |
@ |
settle.js:17 |
|
onloadend |
@ |
xhr.js:66 |
|
Promise.then(비동기) |
|
|
|
(익명) |
@ |
auth.js:10 |
|
invokePassiveEffectCreate |
@ |
react-dom.development.js:23487 |
|
callCallback |
@ |
react-dom.development.js:3945 |
|
invokeGuardedCallbackDev |
@ |
react-dom.development.js:3994 |
|
invokeGuardedCallback |
@ |
react-dom.development.js:4056 |
|
flushPassiveEffectsImpl |
@ |
react-dom.development.js:23574 |
|
unstable_runWithPriority |
@ |
scheduler.development.js:468 |
|
runWithPriority$1 |
@ |
react-dom.development.js:11276 |
|
flushPassiveEffects |
@ |
react-dom.development.js:23447 |
|
(익명) |
@ |
react-dom.development.js:23324 |
|
workLoop |
@ |
scheduler.development.js:417 |
|
flushWork |
@ |
scheduler.development.js:390 |
|
performWorkUntilDeadline |
@ |
scheduler.development.js:157 |
GET http://localhost:3000/api/user/auth 500 (Internal Server Error)
|
dispatchXhrRequest |
@ |
xhr.js:210 |
|
xhrAdapter |
@ |
xhr.js:15 |
|
dispatchRequest |
@ |
dispatchRequest.js:58 |
|
request |
@ |
Axios.js:108 |
|
Axios.<computed> |
@ |
Axios.js:129 |
|
wrap |
@ |
bind.js:9 |
|
auth |
@ |
user_action.js:23 |
|
(익명) |
@ |
auth.js:10 |
|
invokePassiveEffectCreate |
@ |
react-dom.development.js:23487 |
|
callCallback |
@ |
react-dom.development.js:3945 |
|
invokeGuardedCallbackDev |
@ |
react-dom.development.js:3994 |
|
invokeGuardedCallback |
@ |
react-dom.development.js:4056 |
|
flushPassiveEffectsImpl |
@ |
react-dom.development.js:23574 |
|
unstable_runWithPriority |
@ |
scheduler.development.js:468 |
|
runWithPriority$1 |
@ |
react-dom.development.js:11276 |
|
flushPassiveEffects |
@ |
react-dom.development.js:23447 |
|
(익명) |
@ |
react-dom.development.js:23324 |
|
workLoop |
@ |
scheduler.development.js:417 |
|
flushWork |
@ |
scheduler.development.js:390 |
|
performWorkUntilDeadline |
@ |
scheduler.development.js:157 |
그리고 콘솔에는 아래처럼 오류가 뜹니다.
TypeError: Cannot read property 'findByToken' of undefined [0] at auth (C:\Users\이상호\Downloads\Code\Web\Nodejs_Project\backend\auth.js:5:10) [0] at Layer.handle [as handle_request] (C:\Users\이상호\Downloads\Code\Web\Nodejs_Project\node_modules\express\lib\router\layer.js:95:5) [0] at next (C:\Users\이상호\Downloads\Code\Web\Nodejs_Project\node_modules\express\lib\router\route.js:137:13) [0] at Route.dispatch (C:\Users\이상호\Downloads\Code\Web\Nodejs_Project\node_modules\express\lib\router\route.js:112:3) [0] at Layer.handle [as handle_request] (C:\Users\이상호\Downloads\Code\Web\Nodejs_Project\node_modules\express\lib\router\layer.js:95:5) [0] at C:\Users\이상호\Downloads\Code\Web\Nodejs_Project\node_modules\express\lib\router\index.js:281:22 [0] at Function.process_params (C:\Users\이상호\Downloads\Code\Web\Nodejs_Project\node_modules\express\lib\router\index.js:341:12) [0] at next (C:\Users\이상호\Downloads\Code\Web\Nodejs_Project\node_modules\express\lib\router\index.js:275:10) [0] at cookieParser (C:\Users\이상호\Downloads\Code\Web\Nodejs_Project\node_modules\cookie-parser\index.js:57:14) [0] at Layer.handle [as handle_request] (C:\Users\이상호\Downloads\Code\Web\Nodejs_Project\node_modules\express\lib\router\layer.js:95:5)
아래는 깃허브입니다.
와 감사합니다...! mogoose.model()에 넣은 이름이랑 module.exports할 변수이름이랑 같게 하니까 정상작동하네요!