Web Service Installation and Configuration MIS 3406 Department of MIS Fox School of Business Temple University
GuessANumber Port 80 Port 8080
Poke a few holes in the firewalls Serving up GuessANumber.html Open up port 80 (if you didn’t when you created –IIS) on the Azure firewall Check to make sure port 80 is open on the Windows firewall Talking to GuessANumber.js Open up port 8080 on the Azure firewall Open up port 8080 on the Windows firewall
GuessANumber.html Code Review Standard stuff from 2402 Very basic HTML. A few buttons and a place to enter a number What we really care about!
GuessANumber.html Code Review Declare a few variables and point to our nodejs server Generate a random number and tell our nodjs server to start a new game Send our guess and display the result
GuessANumber.html Store GuessANumber.html in C:\inetpub\wwwroot on TUA12345-IIS1
GuessANumber.js Code Review We’ll use express to route requests and body-parser to make it easy to read data passed to us Set body-parser up to deal with both urlencoded data and data in json format
GuessANumber.js Code Review CORS takes care of browser security issues when data is passed between domains
GuessANumber.js Code Review Do 3 things when we receive a “startGame” request: Generate a random number between 1 and 100 Write that random number to a .NumberToGuess file Send the “Game started” message back to the client
GuessANumber.js Code Review When we receive a “guessMade” request…: Tell them they guessed too low or… Tell them that they guessed too high or… Tell them they guessed correctly and delete the .NumberToGuess file
GuessANumber.js Code Review Wait for “startGame” and “guessMade” requests. Express will route requests to the right block of node.js code
GuessANumber.js Store GuessANumber.js in the directory created for Node.js code in Tech Challenge #6 Fire it up