Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making nodejs application run on 0.0.0.0 rather than on localhost

Tags:

node.js

I am trying to run this app https://github.com/nheidloff/conversation-optimizer-for-ibm-watson It is running only on 127.0.0.1

# netstat -plnt                    │
Active Internet connections (only servers)                                                                  │
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name            │
tcp        0      0 127.0.0.1:6001          0.0.0.0:*               LISTEN      411/node

How do I make it run on 0.0.0.0? I tried reading the code but since I am not a programmer I am unable to makeout what to change so posting the git URL above.

like image 244
Siju George Avatar asked Nov 06 '22 23:11

Siju George


1 Answers

This is in /config/webpack.prod.js:

const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 8080;

and this is in /config/webpack.dev.js:

const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
const HOST = process.env.HOST || '0.0.0.0';
const PORT = process.env.PORT || 3000;

So if it is usinf localhost instead of 0.0.0.0, the app is using production config. To set it to use development config, run: webpack --env dev

like image 143
SanSolo Avatar answered Nov 15 '22 07:11

SanSolo