Routes and bodies — Basics · Express

Read request bodies with express.json(), create, change and delete cats, and declare the routes one path shares once with app.route(). Plus what Express 5 leaves in req.body when there is nothing to parse.

What you will learn

Read the theory for Routes and bodies

All Basics lessons

All Express courses

loading types…

What you'll learn

  • Mount express.json() so JSON request bodies arrive in req.body, and handle a body that was not parsed
  • Declare several methods on one path with app.route()
  • Answer a create with res.status(201).location(…).json(…) and a delete with res.sendStatus(204)