title: Querying my Cloud Sql DB from my Node.js backend
body: <p>Recently I've been learning google cloud sql it took a little but I was able to connect my cloud sql auth proxy to my postgres client. However I'm not sure how to query or make post request to my cloud sql. Originally I was just doing</p>
  <pre><code>const Pool = require(&quot;pg&quot;).Pool;
  
  const pool = new Pool({
      user: &quot;postgres&quot;,
      password: &quot;****&quot;,
      host: &quot;localhost&quot;,
      port: 5432,
      database: &quot;somedb&quot;
  });
  </code></pre>
  <p>I'm not sure how to convert this over to try and query the cloud sql db. I did try converting it and got.</p>
  <pre><code>const Pool = require(&quot;pg&quot;).Pool;
  
  const pool = new Pool({
      user: &quot;postgres&quot;,
      password: &quot;****&quot;,
      host: &quot;[cloud sql ip]&quot;,
      port: 5432,
      database: &quot;[pg/gc db]&quot;
  });
  </code></pre>
  <p>I end up getting the error [pg_hba.conf rejects connection for host &quot;[ipv4 ip]&quot;, user &quot;postgres&quot;, database &quot;[pg/gc db]&quot;, no encryption]. I know that the documentation has a code sample but I don't understand it and cant really find any resources on explaining it.</p>
  <p>Edit: I am uploading files to a bucket in cloud storage which I was successfully able to do. I plan on mapping out all these files onto a webpage. However I would like to filter them by certain features so I am making a second request after I store the file. My second request will store attributes into a database that I can then relate to the files for filtering.</p>