'Can't connect to my node.js server

I am having problems with my node.js web server.

My server is listening on port 80 and I can connect to it through localhost:80 but I can't connect through my domain name.

I have a free domain name that is pointing to a dynamic DNS since I have a dynamic IP address. I installed the program needed to update my IP address.

Am I doing something wrong or am I missing something?



Solution 1:[1]

Because of NAT, your computer is not accessible from the internet. Your router is the only device that is accessible, and the only device that has an IP on the internet.

But your router has the ability to forward all data that someone sends to it to another computer in your local network. So if you want to make your computer accessible from the internet, you have to do such a forwarding. You must define it in your routers settings.

Hope this helps.

Solution 2:[2]

I'm guessing this is to do with your server definition.

The default server.listen given in the examples..

server.listen(1337, "127.0.0.1");

Will only listen to connections from localhost. To get it to respond to any request try the following (the host part is optional)

server.listen(1337);

Solution 3:[3]

2 Things to try.

  1. use this, if you haven't

app.listen(3000, "0.0.0.0")

  1. In db.js file, go for this URI:

DB_URI = "postgresql://localhost/database_name";

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Van Coding
Solution 2 superbimble
Solution 3 Maulik Vaghela