Hello everyone I keep getting “Error: Connection terminated unexpectedly” when I hit the endpoint that makes a request to get the data from the PostgreSQL database.
I have hosted my Postgresql database on Render and I have created two tables.
The “/” route works fine but “/personaltodos” endpoint keeps loading and doesn’t give any json data.
You can check my express code here: todosapp-server/server.js at main · MubashirWaheed/todosapp-server · GitHub
I have setup the environment variables in the render
I also tried adding SSL flag bu doesn’t work (can check my commit history)
EDIT
I changed the port to 3000 and I am getting the following error in the logs
Error: connect ECONNREFUSED 127.0.0.1:5432
Jun 25 04:13:16 PM at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
Jun 25 04:13:16 PM errno: -111,
Jun 25 04:13:16 PM code: 'ECONNREFUSED',
Jun 25 04:13:16 PM syscall: 'connect',
Jun 25 04:13:16 PM address: '127.0.0.1',
Jun 25 04:13:16 PM port: 5432
Can’t figure out what is the issue even after so much time