SCMP 318 – Node.js

Goal

To get the two Node.js programs running for you:

  • PhoneNodeREST – a MySQL program that uses node.js with Express, with a RESTful interface
  • socketChat – a full featured webchat program written with node.js and and socket.io

Resources

Steps

Step 1 – Get PhoneNodeREST setup and running.

  1. Clone the PhoneNodeREST
  2. Edit PhoneServer.js
    – Change to database credentials to use your phone database
    – Change the port to your port number (see Port Assignments)
  3. Edit public/phoneApp.js
    – Change port to your number
  4. Add Express and mysql to your directory:
    npm install express
    npm install mysql2
  5. Run the program:
    node PhoneServer.js
  6. Go to the webpage: jimskon:90nn (where 90nn is your port number)
  7. Try it out!

Step 2 – Get socketChat setup and running

  1. Clone the socketChat project
  2. Edit chatApp.js
    – Change the port to your port number (see Port Assignments)
  3. Edit chatClient.js
    – Change port to your number
  4. Add socket.io to your directory by copying my node_modules. Also init npm (use default values):
    npm init
    cp -r ~skon/socketChat/node_modules .
  5. Run the program:
    node chatApp.js
  6. Go to the webpage: jimskon:90nn (where 90nn is your port number)
  7. Try it out!

Turn in:

  1. Paths to your projects
  2. Links to your program (Run the PhoneApp in the background)

Scroll to Top