WebFund 2013W: Task 2

From Soma-notes

Your task for this set of tutorials are as follows:

  • Choose a partner or partners, form a team.
  • Setup a team in github with the help of a TA or instructor. You need your github usernames and a team name.
  • Try the tutorial for making a simple blog. The tutorial is at howtonode.org/express-mongodb.

Simple Blog tutorial

The tutorial needs administrative access. In the lab, you can go to VirtualBox, run the COMP 3004 VM, and login as user "admin" with the password "nimda!". We suggest running this VM in full-screen mode and accessing the web from within the VM. This way, files that you download will be easily accessible.

Do not expect to understand much of what you will be doing in this tutorial at first. We will be explaining pieces of this code in the upcoming weeks. Think of this more as a way to see what a simple node web application will look like.

This tutorial is against an older version of the packages. The comments at the end of the tutorial can help you fix the bugs (particularly the first one).

Alternately, a working version with bugs fixed, including all the functionality up to the comments part (i.e., in includes basic MondoDB functionality) is here. To get it running in the lab VMs do the following commands.

To get node and mongo DB installed:

sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm nodejs-dev mongodb
sudo npm install express -g  # from the tutorial

Then:

wget http://homeostasis.scs.carleton.ca/~soma/webfund-2013w/blog.zip
unzip blog.zip
cd blog
npm install -d
node simple-express.js

This should get you hello world on localhost:3000.

To run the in-memory version, run:

node app-memory.js

To run the mondo DB version:

node app-mondo.js

These are on localhost:3002 by default. By default the mondo version won't have any posts; to add one, visit http://localhost:3002/blog/new .

Good luck!