[
  {
    "path": ".gitignore",
    "content": "*~\n.DS_Store\n.vagrant"
  },
  {
    "path": "README.md",
    "content": "This is a Vagrant file for building a basic node development\nenvironment.  It was primarily built as a companion to my book,\nLearning Web App Development. You can read more about it at\nhttp://learningwebappdev.com.\n\n\nIf you're not familiar with Vagrant, read more about it\nat http://www.vagrantup.com.\n\nTo get this to work, you must have VirtualBox (> 5.1.0) and Vagrant (>\n2.0) installed.  I've most recently been testing it with VirtualBox\n5.1.30 and Vagrant 2.0.2. Please post an issue if you're having\nproblems with other versions, and I'll see if I can track it down.\n\n\nInstallers for VirtualBox are available at http://www.virtualbox.org,\nand installers for Vagrant are available at http://www.vagrantup.com.\n\nOnce you have the pre-requisites installed, you should be able to\nclone this repository\n\n    git clone https://github.com/semmypurewal/node-dev-bootstrap.git\n    my_project\n\nand change to your new project directory to start your VM:\n\n    cd my_project vagrant up\n\nNote that the Vagrantfile will download and install the xenial32\nvagrant box if you don't already have it.\n\nAfter a few minutes, you should have a virtual dev environment with\nnode, npm, mongodb and redis.  The app folder is shared, and port 3000\non the VM is forwarded to port 3000 on the localhost. This is all\ncustomizable in the Vagrantfile.\n\nYou can test out your environment by ssh'ing into your environment and\nrunning the sample script:\n\n    vagrant ssh cd app node server.js\n\nNext open localhost:3000 in your web browser. If everything worked\ncorrectly, you should see 'Hello World'\n\n## Important note about Installing NPM Packages\n\nLater versions of VirtualBox do not support symlinks in shared\nfolders. More info is available here:\nhttps://www.virtualbox.org/ticket/10085\n\nThis can cause problems when you're attempting to install certain\npackages via npm. For example, the 'jade' and 'express' packages\ncreate symlinks during installation, and therefore the installation\nwill fail in the shared 'app' directory.\n\nThe best workaround for this is to install node packages in your\nshared folder with the --no-bin-links flag, e.g.\n\n    npm install express --no-bin-links\n\nIf VirtualBox is your provider and you're using MacOS, you may also\nwant to try to uncomment the \"setextradata\" customization in the\nVagrantFile to allow symlinks to work.\n\nI'm not sure how this affects other Virtual Machine providers."
  },
  {
    "path": "Vagrantfile",
    "content": "Vagrant::Config.run do |config|\n  config.vm.box = \"ubuntu/xenial32\"\n\n  config.vm.forward_port 3000, 3000\n\n  config.vm.share_folder \"app\", \"/home/vagrant/app\", \"app\"\n\n  # Uncomment the following line to allow for symlinks\n  # in the app folder. This will not work on Windows, and will\n  # not work with Vagrant providers other than VirtualBox\n  # config.vm.customize [\"setextradata\", :id, \"VBoxInternal2/SharedFoldersEnableSymlinksCreate/app\", \"1\"]\n\n  config.vm.provision :shell, :inline => \"sudo apt-get update && sudo apt-get -y upgrade\"\n  config.vm.provision :shell, :inline => \"sudo apt-get install -y build-essential libssl-dev --no-install-recommends\"\n  config.vm.provision :shell, :inline => \"sudo apt-get -y install nodejs npm\"\n  config.vm.provision :shell, :inline => \"sudo ln -sf /usr/bin/nodejs /usr/bin/node\"\n  config.vm.provision :shell, :inline => \"sudo apt-get install -y redis-server --no-install-recommends\"\n  config.vm.provision :shell, :inline => \"sudo apt-get install -y mongodb --no-install-recommends\"\n  config.vm.provision :shell, :inline => \"sudo apt-get install -y ruby2.3-dev --no-install-recommends\"\n  config.vm.provision :shell, :inline => \"sudo apt-get install -y ruby2.3 --no-install-recommends\"\n  config.vm.provision :shell, :inline => \"sudo gem install cf\"\nend\n"
  },
  {
    "path": "app/server.js",
    "content": "var http = require(\"http\"),\n    server;\n\nserver = http.createServer(function (req, res) {\n    res.writeHead(200, {\"Content-Type\": \"text/plain\"});\n    res.end(\"Hello World!\\n\");\n});\n\nserver.listen(3000);\n\nconsole.log(\"Server running on port 3000\");\n"
  }
]