Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing node.js server on my local system using android app

I have a node.js server running on my local system which interacts with postgresql in the same system to fetch and save data. I want to access node.js server from my android app to save and fetch data from postresql. The problem is my app is not able to connect to localhost. As localhost for my phone is different from my local system and if I am providing my system's IP address then also its refusing the connection.

like image 747
vishal gaurav Avatar asked Sep 21 '26 17:09

vishal gaurav


1 Answers

I made server listen to hostname '0.0.0.0'. Initially I was not providing any hostname as argument in server.listen i.e it was like server.listen('portnumber') which I changed to server.listen('portnumber', '0.0.0.0');

like image 189
vishal gaurav Avatar answered Sep 23 '26 06:09

vishal gaurav



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!