In Express.js all the query parameters are stored in the object req.query, so you can access them in any of your route handlers or middleware functions.

So imagine your Express backend is running on and your client tries to GET

const routeHandler = (req, res, next) => {
  console.log(;      // 125
  console.log(;    // hero
  console.log(req.query.surname); // undefined

In the example above I accessed the query string variables id and name and logged them to the screen. The parameter surname is undefined as it’s missing from the query string.