🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Nothing; Express always parses JSON
  2. B.The JSON middleware, app.use(express.json())
  3. C.A database connection
  4. 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 →