Handling JSON Requests

Express can handle JSON request bodies using the built-in `express.json()` middleware.

Snippet:

app.use(express.json()); app.post("/data", (req, res) => res.json(req.body));

Example:

app.use(express.urlencoded({ extended: true })); app.post("/form", (req, res) => res.send(`Received: ${req.body.name}`));