title: Connection refused for 127.0.0.1:5433 postgresql node js
body: <p>I have node js server that works perfectly on my local machine. While setting up on the server, it throws an error : Connection Refused.</p>
  
  <p>Here are the details:</p>
  
  <pre><code>pg_config = "postgres://postgres@localhost:5433/crda_test"; 
  or pg_config = "postgres://postgres@::1:5433/crda_test"; 
  or pg_config = "postgres://postgres@127.0.0.1:5433/crda_test"; 
  </code></pre>
  
  <p>About postgresql :</p>
  
  <pre><code>Version: 9.6 postgresql 
  psql -U postgres  -h localhost  -p 5433 (This works perfectly fine)
  psql -U postgres  -h ::1  -p 5433 (This works perfectly fine)
  psql -U postgres  -h 127.0.0.1  -p 5433 (This works perfectly fine)
  </code></pre>
  
  <p>Output for this command given below:</p>
  
  <blockquote>
    <p>sudo lsof -n -u postgres |grep LISTEN (Output of this given below)</p>
  </blockquote>
  
  <pre><code>postgres 15072 postgres    3u  IPv6           15677592      0t0      TCP [::1]:5433 (LISTEN)
  postgres 29773 postgres    3u  IPv6           15519790      0t0      TCP [::1]:5435 (LISTEN)
  </code></pre>
  
  <p>This command shows that port is listening and why am I not able to make a request. It helps me a lot if someone can throw some light on this. 
  Below is the error while running the server on remote machine:
  <a href="https://i.stack.imgur.com/Ud2Oh.png" rel="nofollow noreferrer">enter image description here</a></p>