Express 5 · Routing

Handle a JSON body

Parse JSON request bodies, then read req.body.

app.use(express.json());

app.post("/users", (req, res) => {
  res.status(201).json(req.body);
});

Official Express 5 documentation

More routing commands

All routing commands · Express 5 cheatsheet

Was this page helpful?