What is the difference between req.params, req.query and req.body?

Express basics and middleware · Freshers

Model answer

req.params holds route parameters from the path, such as :id in /users/:id. req.query holds the query string, such as ?page=2. req.body holds the data sent in the request body, available after a body parser such as express.json().

Learn this topic

Express Middleware Explained: next(), Logging and express.json() in the course Node.js and Express: Build a Back End API from Scratch.

Sign in to add your own answer.

More questions