Node
Login to the desktop in the lab, do all of your work there!
Do not log into cslinux. Try to avoid looking at the lecture examples as much as possible.
- Get hello-https.js
running on your lab system. Run with
node hello-http.js
and then use the following URL in your browser...
http://localhost:8000
. Kill node with ctrl-c.
- Unscramble guessGame1.js so that it responds to
requests like
http://localhost:8000/?guess=4
and plays the guess game with secret number 5.
Hint: Take a look at hello-https.js
- Now add a web page with a form so that
the user can submit the form to play the game.
For example...
- Unscramble guessGame2.js
so that each user has their own session.
Examine the cookie sent to each user. If you want to play your neighbours
game, you can (if a firewall is not blocking)
http://dh2020pcXX.utm.utoronto.ca:8000
- Take the changes made to guessGame1.js and add them to guessGame2.js
so that it has a real user interface (web form).
Hints
- Run node on the local lab system (don't ssh into anywhere else).
- Start node running on
guessGame.js
by executing node guessGame1.js
at a unix comand prompt.
- If you can't start node, perhaps you (or someone else) already has port 8000 open already.
- cslinux appears to be blocking ports, so running there and then connecting from the lab systems may not work.
- If you change your code, you need to shut down node and then restart it.