Skip to content
Weekly examples
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
week10-assets
week11-assets
week12-assets
week2-assets
week5-assets
week6-assets
week7-assets
week8-assets
week9-assets
.gitignore
heroku.js
package-lock.json
package.json
readme.md
week10.js
week11.js
week12.js
week2.js
week3.js
week4.js
week5.js
week6.js
week7.js
week8.js
week9.js

readme.md

Web 322 examples

The repo contains examples for the WEB 322 course for Seneca College.

Contents

Requirements

The examples require some preparation ahead of time to be able to pull them down and run them. The first thing you will need is Git on your computer. Windows users can download Git for Windows (msysgit) and Mac users will need Git for Mac

After installing Git you will be able to clone this repository.

You will need to also install other applications to run the examples once the repository is cloned.

Cloning the repo

The command to clone the repo is:

git clone https://github.com/Seneca-WEB322/examples.git.

You will want to already be in the folder where you want the repo to be cloned and stored. A good place is c:\gitrepos on windows or /gitrepos on mac. A gitrepos folder right in your root of your main drive. You can put it anywhere you want though.

Important Note: If you run the 'git clone' command from within an open folder Visual Studio Code, you will need to close the current folder and open the newly cloned 'examples' folder before you start working.

Running the examples locally

One you have cloned the repo you will want to make sure you are in the main folder and you can set up the examples.

The main step is to run npm install in the repo to install all the packages that the examples are dependant on.

npm install

The week 8 example requires MongoDB to be running as well. See the class notes for instructions on that.

When you want to deploy one of the examples to Heroku you will need to edit the package.json file for the start property uder scripts. Change the command to the example you want Heroku to run.

For example, to run the week 2 example on Heroku, make the following changes in package.json:

"scripts": {
  "start": "node week2.js"
},

Running the examples on Heroku

See the guide for working with Heroku to learn about setting up your account and pushing code first. This readme assumes you are already familiar with how to push to Heroku and have your account setup already.

To run the examples on your Heroku account, you just have to edit the package.json and set the script property to the file you want Heroku to run automatically.

To have Heroku run the week 5 example edit your package.json file like this:

"scripts": {
  "start": "node week5.js"
},

Descriptions of the examples

  • heroku.js - A basic hello world example you can push to Heroku to test your account
  • week2.js - A basic hello world using Express.js
  • week3.js - A set of functions that can be run to demonstrate different JavaScript features
  • week4.js - A more detailed Express.js example with routes and 404 handling
  • week5.js - An Express.js app that handles file uploading
  • week6.js - An Express.js app that uses the handlebars templating library
  • week7.js - An Express.js demonstrating a connection to PostgreSQL database using Sequelize
  • week8.js - An Express.js photo book app that connects to MongoDB and handles saving pictures
  • week9.js - An Express.js REST API and test client (HTML / AJAX)
  • week10.js - An Express.js app with client sessions and basic logins
  • week11.js - An Express.js app that serves up a "home" view, containing jQuery and Bootstrap examples
  • week12.js - A more advanced Express.js app with secure HTTPS logins and client sessions

Submitting corrections or updates

You can submit a correction or update to the code if you find it is necessary. Examples are bug fixes, package updates, updates for Heroku requirements, readme.md fixes, etc.

Speak to your professor about forking the repo, creating a patch, and submitting a pull request for the changes. You may need permission to create an issue or pull request on this repository.

You can’t perform that action at this time.