Skip to content

SCUACM/node-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SCU ACM Node Workshop

  • This is a simple workshop that will cover basic Node.js, Express, and Socket.io usage.
  • You will be creating a web chat application and deploying it to the Cloud.

Getting Started

Installing Node.js and NPM (non-Windows)

  • Install NVM
  • Install the latest version of Node.js: nvm install 10
  • Check that it worked: node --version and npm --version
  • Update NPM to the latest version: npm install --global npm

Installing Node.js and NPM (Windows)

  • If you are using Windows, you can use a Linux VM or...
  • Install NVM for Windows
  • Install the latest version of Node.js: nvm install latest
  • Close and re-open Command Prompt
  • Check that it worked: node --version and npm --version
  • Update NPM to the latest version: npm install --global npm

Getting the Source Code

  • Install git if you have not already.
  • cd to the directory you want to install this repo in.
  • Clone this repo: git clone https://github.com/SCUACM/node-workshop
  • cd into the newly created node-workshop directory.
  • If you ls, you should be able to see package.json.

Project File Structure

  • /package.json - File that specifies app details and dependencies for NPM.
  • /node_modules - Folder for all your app's NPM dependencies.
  • /public - Public-facing (client) code.
  • /public/scripts - Client Javascript (scripting).
  • /public/stylesheets - Client CSS (styling).
  • /public/index.html - Our frontend's main HTML file.
  • /server.js - Main file that holds all our server code.

Running the Server

  • Install all node dependencies: npm install.
  • You can check that it worked if node_modules folder has been created.
  • Run npm start to start your server.

Completed Code

Deploy to the Cloud

  • Create a free account at Heroku.
  • Install Heroku's command-line tool based on your OS.
  • Run heroku login and enter in your new Heroku account's credentials.
  • Run heroku create to create a new Node.js instance.
  • Commit all your changes: git add --all && git commit -m "Your message"
  • Run git push heroku master to send your changes to the Cloud!
  • View your instance on the web: heroku open
  • If you make more changes, commit your new changes and re-push to Heroku.

Moving Forward With Node

Understanding Node.js "Async"

Other Resources

About

Simple Node + Socket.io + Express tutorial

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published