title: Querying Postgres with multiple parameters Node.js
body: <p>I'm just starting with Node.js to build a <code>Node.js</code> server with <code>Postgres</code> db, I have in place a few routes and methods for CRUD operations :</p>
  <pre><code>router.get('/products', productController.listAllProducts);
  </code></pre>
  <pre><code>exports.listAllProducts = async (req, res) =&gt; {
    const response = await db.query('SELECT * FROM products ORDER BY productName ASC');
    if (response.rowCount &gt; 0) {
      res.status(200).send(response.rows);
    } else {
      res.status(404).send({
        message: &quot;No products found&quot;
      });
    }
  };
  </code></pre>
  <p>and in Postman the url <code>localhost:3000/api/products</code> works just fine.
  Now I'm trying to include 3 parameters in the query <code>city</code>, <code>region</code> and <code>country</code></p>
  <pre><code>router.get('/products', productController.findCityProducts); // correct route??
  </code></pre>
  <pre><code>exports.findCityProducts = async (req, res) =&gt; {
    const city = req.query.city;
    const region = req.query.region;
    const country = req.query.country;
    const response = await db.query('SELECT * FROM products WHERE city = $1 AND region = $2 AND country = $3', [city,region,country]);
    if (response.rowCount &gt; 0) {
      res.status(200).send(response.rows);
    } else {
      res.status(404).send({
        message: 'Product not found'
      });
    }
  };
  </code></pre>
  <p>and in Postman I add the 3 parameters so the url is <code>localhost:3000/api/products?city=Bologna&amp;region=Emilia-Romagna&amp;country=Italy</code> but the results are the same as for the <code>listAllProducts</code> method.. and there is no record that satisfies the query..so I guessed the <code>'/products' route can't have more than one method assigned..and is calling </code>listAllProducts<code>..I commented it out and indeed now is calling </code>findCityProduct`.</p>
  <p>How would I to enable both the <code>listAllProducts</code> and <code>findCityProduct</code> queries?
  Many thanks.</p>