The One Page, 10-minute Node Preface.
What is Node?
Setting up Node
Let’s install Node!
Step 1. Click on Install Node here: http://nodejs.org.
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: http://6.470.scripts.mit.edu/day4/app.js (Right click, save as ‘app.js’ without the quotations). Make sure you save it/move it to 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.
Wait, what happened?
It’s alright. We’ll explain a lot of this tomorrow in lecture. If you have trouble with any of these steps, please post a question on Piazza and we’ll answer it as soon as possible.
See you tomorrow!