The One Page, 7-minute Node Preface.

What is Node?

Node is a magical beast that helps you build an amazing web server. And, best of all, it’s in JavaScript, the universally growing web-friendly language. There’s no need for any PHP, Ruby, Dogescript, etc to get your backend up and running. Please follow the instructions below to prepare for tomorrow’s lecture.

Setting up Node

Let’s install Node!

Step 1. Click on Install Node here: 

Step 2. Click Next, Agree to Software Agreement (if you’re on Windows), Next a couple more times, and Install

Step 3. Holy. You’re done! You have so much free time! Maybe read a book, or give some time to that favorite hobby of yours you’ve been neglecting.

Making sure Node is installed correctly

Let’s create a server!

Download the file here:

(right click, save to Desktop as 'app.js' without the quotations)

Move/Save the file onto your Desktop

PC: open up Node.js command prompt (should be in a Node.js folder in your All programs). 

Mac: open up Terminal (in your Applications). 

Navigate to your Desktop (most likely a command like: cd Desktop). 

type the command: node app.js

In the command prompt/terminal, console.log should have logged a message. Visit that link (http://localhost:8000). If you open that in a web browser, you should be able to see a page. Congratulations, it worked! You’re done! Sit tight, and wait for tomorrow’s lecture.

Running Express

Run the following commands:

npm install -g express

npm install -g express-generator

PC: Make sure you can run npm install 

If you can't, and get an error like ENOENT stat: '<some folder name >', then you need to run mkdir <some folder name > so it will work. Make sure you're running the shell in Administrator mode!

Mac: Make sure you run both commands with sudo in front of it, e.g.  sudo npm install -g express

On a PC?

See you tomorrow!