Steps to launch get request with webserver.py file

  • cd fullstack/vagrant
  • vagrant up
  • vagrant ssh
  • cd /vagrant/Full-Stack-Foundations-master/Lesson-2/first-web-server/
  • python webserver.py
  • Open Browser: localhost:8080/hello

Vagrant File

Your Vagrant File for this course looks something like this:

VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision "shell", path: "pg_config.sh" # config.vm.box = "hashicorp/precise32" config.vm.box = "ubuntu/trusty32" config.vm.network "forwarded_port", guest: 8000, host: 8000 config.vm.network "forwarded_port", guest: 8080, host: 8080 config.vm.network "forwarded_port", guest: 5000, host: 5000 end

Port forwarding allows us to open pages in our browser from the web server from our virtual machine as if they were being run locally. See which ports are being used for this class. If you want to use another port you can add another line to the vagrant file and run "vagrant reload" from a terminal in the directory of your vagrant file on your host machine. More information about port forwarding is available here .

Post request

  • Get request: only read data
  • Post request: modify data
  • cd /vagrant/Full-Stack-Foundations-master/Lesson-2/post-web-server/
  • python webserver.py
  • Open Browser: localhost:8080/hello

In [ ]: