강의

멘토링

로드맵

Inflearn Community Q&A

leo0h's profile image
leo0h

asked

Do it! Introduction to Node.js Programming

Body Parser Middleware

바디 파서 질문있습니다

Written on

·

61

0

undefined가 되지 않기 위해 바디파서를 사용해서 우리가 필요한 자료구조로 전달받을 수 있고

바디파서를 사용한다는 의미로

app.use(express.json());
app.use(express.urlencoded({ extended: true }));

이 코드를 추가를 해주셨습니다.

궁금해서 app.use(express.urlencoded({ extended: true })); 를 주석처리하고 실행한 결과 그래도 정상 작동이 됩니다

app.use(express.json()); 

이 부분을 주석처리하고 하면 undefined가 아닌 {} 빈 json을 전달 받습니다

각각 저 코드들이 하는 역할이 궁금합니다

javascriptnode.jsmongodbexpress

Answer

This question is waiting for answers
Be the first to answer!
leo0h's profile image
leo0h

asked

Ask a question