M
M
Maxim Ivanov2016-12-08 12:08:57
Node.js
Maxim Ivanov, 2016-12-08 12:08:57

Why can't I set up an external ip for the webserver right away in NodeJS?

I have server.js web server

et http = require('http'), 
  fs = require('fs'),
  url = require('url'),
  path = require('path'),
  cmd = require('node-cmd'),
  Tail = require('tail').Tail;

let server = new http.Server(); // EventEmitter
let ip = '127.0.0.1';
let port = 8000;

server.listen(port, ip);
console.log(`server listen http://${ip}:${port} ... \n`);
server.on("connection", () => console.log("connection"));
server.on('request', (request, response) => {});

When I log in from my computer at http:// 127.0.0.1:8000
Everything works
However, I'm connected to an external network, why when I connect via external ip http
27e8e93d3df44686943195c7a211e8a1.jpg
:// 10.1.4.58:8000, I see a similar picture
8e15c4ecd49c4ff2ad8c581acc4e542e.png
set up a web server so that it can use my local ip on its external ip? Or how to write the web server config in general?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
catHD, 2016-12-08
@splincodewd

Good afternoon.
Painful to read:
Let's first read this: https://ru.wikipedia.org/wiki/%D0%A7%D0%B0%D1%81%D...
Then you will think about what "interfaces" are.
Then you think about what 0.0.0.0 is and what people use it for.
And then ask the question again.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question