← Quiz: Node, Express and REST: all 10 questions
Quiz: Node, Express and REST · Question 7 of 10
What must you add so that req.body contains the parsed JSON sent by a client?
What must you add so that req.body contains the parsed JSON sent by a client?
- A.Nothing; Express always parses JSON
- B.The JSON middleware, app.use(express.json())
- C.A database connection
- D.The cors package
Answer & explanation
Correct answer: The JSON middleware, app.use(express.json())
Without express.json(), req.body is undefined for JSON requests.
Can you get the rest right without peeking?
Take the timed Quiz: Node, Express and REST quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →