W
W
WizardW2019-04-07 20:58:29
Node.js
WizardW, 2019-04-07 20:58:29

Why is the server not loading on a machine that is on a virtual machine?

Vagrant: Debian
Host: Win10
Vagrant config:

config.vm.network "public_network", ip: "192.168.33.101"

nodejs server:
const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer(function(req, res) {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello, World!\n');
});

server.listen(port, hostname, function() {
  console.log("Ждем реквеста!");
});

I'm trying 192.168.33.101:3000 but it doesn't work.. What's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2019-04-07
@inoise

You listen to one hostname, access another. Five points

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question