learnyounode Unofficial Companion

This article is part of an unofficial companion for learnyounode, a teaching tool for node.js.  I wrote this to help myself understand node.js, and the learnyounode tutorials.  This walkthrough assumes that you will also read the lesson instructions and lesson hints, as well as any referenced documentation in each lesson.  This walkthrough contains both my solutions as well as the official solutions.  However, if one or the other is missing, you can find the solutions on github as well.  Lastly, at the time of writing this, I am far being any kind of expert, so take what I have to say with a grain of salt.

If you already have a good understanding of JavaScript (up to and including objects and prototypes), learnyounode is a great place to start learning node.js. If you are just diving into JavaScript, consider starting with the JavaScript module on codecademy instead. Node is JavaScript first and foremost. Starting with node before establishing a foundation in JavaScript is a lot like trying to sing in a language you don’t know. You might be able to make the noises, but you won’t really understand the meaning.

Additionally, it will be helpful to be familiar with the linux, OS X, or Windows command line.  Unlike JavaScript, which is tested using the browser console, node.js runs from the command line.  If you know how to launch the command line terminal and do simple tasks such as changing directories, you probably know enough to get started.

Getting Started

To get started, download and install the appropriate version of node.js for your operating system.  You can find it here.  If you are Windows user, you will need to restart your computer after you have installed node.  You should also consider using a text editor or IDE with syntax highlighting, but you probably already knew that.  I am partial to Atom (free) or Sublime Text (paid).

After you have installed node, launch the terminal and navigate to the directory you want to install learyounode to, probably ~/user/node-modules/.  Once you have navigated to your preferred directory, enter the following into the command line.

npm install learnyounode -g

If you are a linux or mac user and your download fails, try this instead.

sudo npm install learnyounode -g

Enter your credentials when prompted.

If you are a windows user and your install fails, you are on your own for now (sorry).  If all else fails, try to google the errors you get.  You probably  aren’t the first to run into trouble.

After learnyounode is installed, you can get started by launching it from the command line.

learnyounode

You will know if you were successful when you see the learnyounode menu.

learnyounode

Woah!  Looks like an old DOS program or something.  It is actually a node.js app.  One of the great things about node is that not only can it be used as a server side scripting language, it can also be used to make nifty command line applications such as learnyounode.

Lessons

learnyounode Lesson 1 – Hello World!

learnyounode Lesson 2 – Baby Steps

learnyounode Lesson 3 – My First I/O!

learnyounode Lesson 4 – My First Async I/O!

learnyounode Lesson 5 – Filtered LS

learnyounode Lesson 6 – Make it Modular

learnyounode Lesson 7 – HTTP Client

learnyounode Lesson 8 – HTTP Collect

learnyounode Lesson 9 – Juggling Async

learnyounode Lesson 10 – Time Server

learnyounode Lesson 11 – HTTP File Server

learnyounode Lesson 12 – HTTP Uppercase

learnyounode Lesson 13 – HTTP JSON API Server