title: TypeError: Cannot read property 'rows' of undefined
body: <p>When following <a href="https://blog.logrocket.com/getting-started-with-postgres-in-your-react-app/" rel="nofollow noreferrer">Getting started with Postgres in your React app</a>, at the point where you process and export the getMerchants, createMerchant, and deleteMerchant functions, I am getting this error -- TypeError: Cannot read property 'rows' of undefined, what is going on here?? It is probably something very small I am missing. There error occurs at getMerchants and resolve(results.rows)</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const Pool = require('pg').Pool
  const pool = new Pool({
      user: 'my_user',
      host: 'localhost',
      database: 'my_database',
      password: 'root',
      port: 5432,
  });
  
  const getMerchants = () =&gt; {
      return new Promise(function(resolve, reject) {
          pool.query('SELECT * FROM userIds ORDER BY id ASC', (error, results) =&gt; {
              if (error) {
                  reject(error)
              }
              resolve(results.rows);
          })
      })
  }
  const createMerchant = (body) =&gt; {
      return new Promise(function(resolve, reject) {
          const { name, email } = body
          pool.query('INSERT INTO userIds (name, email) VALUES ($1, $2) RETURNING *', [name, email], (error, results) =&gt; {
              if (error) {
                  reject(error)
              }
              resolve(`A new merchant has been added added: ${results.rows[0]}`)
          })
      })
  }
  const deleteMerchant = () =&gt; {
      return new Promise(function(resolve, reject) {
          const id = parseInt(Request.params.id)
          pool.query('DELETE FROM userIds WHERE id = $1', [id], (error, results) =&gt; {
              if (error) {
                  reject(error)
              }
              resolve(`Merchant deleted with ID: ${id}`)
          })
      })
  }
  
  module.exports = {
      getMerchants,
      createMerchant,
      deleteMerchant,
  }</code></pre>
  </div>
  </div>
  </p>