Postgres md5 authentication from Node
<p>I'm trying to connect to postgres via node using the md5 authentication method.</p>

<p>My pg_hba_conf file looks like this:</p>

<pre><code> "local" is for Unix domain socket connections only 
 local   all           all                                      md5 
 IPv4 local connections:
 host    all             all            127.0.0.1/32            md5
 IPv6 local connections: 
 host    all             all            ::1/128                 md5
</code></pre>

<p>I can connect to the database via psql without any problems, but my question is how do you create the connection string within node to connect to postgres when via md5? If I change the pg_hba.conf to use 'password' as the authentication method, then I can connect to the database with the following:</p>

<pre><code>let connectionString = postgres://user:password@localhost:5432/database';
</code></pre>

<p>I had thought that I could md5hash my password within the connectionString e.g:</p>

<pre><code>let password = crypto.createHash('md5').update(my_password).digest('hex');

let connectionString = 'postgres://user:' + password + '@localhost:5432/database';
</code></pre>

<p>But this didn't work :-(</p>

<p>Can someone point me in the right direction as to how you access postgres via Node using md5 authentication?</p>

<p>Cheers</p>