Skip to content
This repository has been archived by the owner on Jul 25, 2020. It is now read-only.
Alano Terblanche edited this page Aug 26, 2018 · 5 revisions

Week 2

Covered in this week:

  • Introducing MEAN
  • Node.js Fundamentals
  • Node.js Server
  • Hosting html pages
  • Parsing parameters from url
  • Url routing
  • Code Examples covered

Pre-reading Quiz

Week 2 Pre-reading Quiz

Resources

Alexandria Repository

If you're using IntelliJ: IntelliJ NodeJs

Fast-track summary of Alexandria Repository

Please still go through the Alexandria notes

Initialise NodeJs Application

This will create a package.json file

npm init

Download and install Express package into node_modules folder inside your project & add express (latest version) to the list of dependencies in pakcage.json file

npm install express --save

To run your application

node <application-name>.js

Please look at code examples folder for examples of running code

Lab 1

Tasks

  • add a new function that removes all the elements in the queue
  • add a new function that adds set of items into the queue
    • E.g: queue.addAll([3,7,1,9])
  • add a function that pops (dequeues) N elements from the queue. The function should reject the input if there is no enough element to be removed.
    • E.g: queue.dequeueN(2); // pop 2 elements
  • add a new function that prints the content of the queue with their indexes. The output can be something like:
    • 1–>34
    • 2–>30
    • 3–>11
    • 4–>-3

Code to build from

Workshop Quiz

Clone this wiki locally