NodeCasts: Free Node.js Screencasts
Episode 2: Node.js First Steps
Aug 6, 2012 - 7:30 - 7 comments

First, we'll learn out how to install Node.js on Linux, Mac, and Windows, as well as how to maintain different Node versions using NVM. We'll also build a basic HTTP server using Node.js.

Show Notes
Node.js version used in this episode: v0.8.5 [ DownloadsDocumentation ]



Download and install Xcode from the Apple website. For Xcode 4.4 and above, install the Command Line Tools from the Xcode → Preferences menu, in the Downloads tab.

Installing Git

You can install Git via a package manager like Homebrew, or download an installer from the Git website.

Installing NVM

git clone git:// ~/.nvm
source ~/.nvm/
echo "source ~/.nvm/" >> ~/.bashrc
nvm install v0.8.5
nvm alias default v0.8.5

On OS X, you can ensure that ~/.bash_profile loads ~/.bashrc by making ~/.bash_profile contain the following:

[[ -s ~/.bashrc ]] && source ~/.bashrc

To use a version of Node.js that you previously installed, pass it to nvm use:

nvm use v0.8.4

Basic HTTP Server

var http = require('http');

var server = http.createServer(function(request, response) {
  var url = request.url;
  response.writeHead(200, {
    'Content-Type': 'text/html'
  response.end("<h1>Hello from Node.js!</h1><p>You request the URL: " + url + "</p>");

Brad Bicknell, 11 years ago:
Thanks for the great screencast. Definitely looking forward to future casts.
leonardocsouza, 11 years ago:
Thank you for this awesome introduction! Also thank you so much for the detailed instructions in the Show Notes. Very helpful for those starting to play with Node.js. :)
Sumitro Chatterjee, 11 years ago:
Thanks a lot. This is great and just the method I prefer to learn a new language/tool.
rmyock, 10 years ago:
Super helpful video and great way to learn the basics of node.js!
iamwave007, 9 years ago:
love it
Tony Momoh, 9 years ago:
splendid :D
RichardForrester, 8 years ago:
Excellent!!! I'm really excited to learn about node.js -- coming from the Laravel framework.
Log in to add your comment!