강의

멘토링

로드맵

Inflearn Community Q&A

liki57195's profile image
liki57195

asked

Node and React series that you can learn by following - Basic lecture

Node React Basics Lecture #7 BodyParser & PostMan & Membership Registration Function

TypeError: User is not a constructor

Resolved

Written on

·

4.4K

3

postman에서 보내면 서버에서 에러 메시지가 나오네요.

reactnodejs

Answer 3

8

skywalk님의 프로필 이미지
skywalk
Questioner

해결하였습니다.

User.js 파일에서 

module.exports = {User} 에서 User를 누락 했습니다.

0

John Ahn님의 프로필 이미지
John Ahn
Instructor

아넵 ^^   막힐때에는 언제든 다시 질문 주세요 !! 

0

skywalk님의 프로필 이미지
skywalk
Questioner

// code
const {User} = require('./models/User');
app.post('/register',(req,res) =>
const user = new User(req.body);
user.save((err,userInfo) => {     // mongdb command
    if(err) return res.json({ success: false,err})
    return res.status(200).json({ success: true })
  })

}) // end of post
liki57195's profile image
liki57195

asked

Ask a question