wobsoriano
wobsoriano

Reputation: 13462

Run expressjs on Vagrant Scotch-Box

I am using a preconfigured Vagrant Box named scotch-box and want to run expressjs there.

The first thing I did is to npm install -g express-generator and when I try to run it on my browser, it doesn't work because the IP Address of the Vagrant Box is always http://192.168.33.10/. How can I make it work like just typing localhost:3000 on my browser?

Any help would be much appreciated.

Upvotes: 0

Views: 718

Answers (1)

Frederic Henri
Frederic Henri

Reputation: 53783

You could use the IP directly and indicate your port 192.168.33.10:3000

If you do not use the IP, you will need to forward port in your Vagrantfile

Vagrant.configure(2) do |config|
  blablabla some configuration

  # forward port for node app
  config.vm.network "forwarded_port", guest: 3000, host: 3000

  continue blabla
end

so you will be able to access localhost:3000 ?

Upvotes: 1

Related Questions