'why i am getting undifine when i console req.query?

this is api.js file

function apiKey(res, req, next) {
  const api_key = '12345678';
  console.log(req.query);
  next();
}

module.exports = apiKey;


Solution 1:[1]

You named it wrong way. should be like this

function apiKey(req, res, next) {
 const api_key = '12345678';
 console.log(req.query);
 next();
}

module.exports = apiKey;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 eFortsHub