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
7 comments
Node.js version used in this episode: v0.8.5 [ DownloadsDocumentation ]

Links

Xcode

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://github.com/creationix/nvm.git ~/.nvm
source ~/.nvm/nvm.sh
echo "source ~/.nvm/nvm.sh" >> ~/.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>");
});

server.listen(3000);
Brad Bicknell, 12 years ago:
Thanks for the great screencast. Definitely looking forward to future casts.
leonardocsouza, 12 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, 12 years ago:
Thanks a lot. This is great and just the method I prefer to learn a new language/tool.
rmyock, 11 years ago:
Super helpful video and great way to learn the basics of node.js!
iamwave007, 10 years ago:
love it
Tony Momoh, 10 years ago:
splendid :D
RichardForrester, 9 years ago:
Excellent!!! I'm really excited to learn about node.js -- coming from the Laravel framework.
Log in to add your comment!