title: How to connect to postgres inside docker compose with NodeJs?
body: <p>I have installed Mainflux in Cloud Server using Docker. Postgres DB is also 
       running in Docker Container. I have a situation to connect to PostgresDB with Node.Js(programmatically). I found "pg" module to connect to Cloud 
       Postgres DB. But, am unable to connect to Postgres which is running on 
       Docker Container. I pasted my code below, pls let me know the scenario to connect "Docker Postgres". </p>
  
  <pre><code>  const pg = require('pg');
    const conStringPri = postgres://mainflux:mainflux@MYIP/mainflux-things-db;
    const Client = pg.Client;
    const client = new Client({connectionString: conStringPri});
    client.connect();
    client.query(CREATE DATABASE DB_Name)
    .then(() =&gt; client.end());
  </code></pre>
  
  <p>Getting error as below: </p>
  
  <blockquote>
    <p>node:8084) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 
         MYIP:5432
          at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
          (node:8084) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 
          This error originated either by throwing inside of an async function 
          without a catch block or by rejecting a promise which was not handled with 
          .catch() (rejection id: 1)
          (node:8084) [DEP0018] DeprecationWarning: Unhandled promise rejections are 
            deprecated. In the future, promise rejections that are not handled will 
            terminate the Node.js process with a
            non-zero exit code.
             (node:8084) UnhandledPromiseRejectionWarning: Error: Connection 
           terminated unexpectedly
             at Connection.con.once 
            (D:\postgres_Nodejs\node_modules\pg\lib\client.js:200:9)
             at Object.onceWrapper (events.js:313:30)
             at emitNone (events.js:106:13)
             at Connection.emit (events.js:208:7)
             at Socket.
               (D:\postgres_Nodejs\node_modules\pg\lib\connection.js:76:10)
             at emitOne (events.js:116:13)
             at Socket.emit (events.js:211:7)
             at TCP._handle.close [as _onclose] (net.js:561:12)</p>
  </blockquote>