Skip to main content

Node.js Beginner Introduction

What is Node.js
Short version: JavaScript engine from Chrome with modules for handle files and httpServer.

In this post:

  1. Installation
  2. Cloud9 IDE
  3. Hosting
  4. Example

1: Installation
Go to and decide if You want stable (4.*) version or dev (5.0-pre).
Stable can be downloaded from: with tar.gz format.
Dev from github.
On my ubuntu it was pretty easy, but If You fail to install it, don't give up and check section about Cloud :)

2: Cloud
Sign up for beta at:
Cloud9 IDE uses github for

  1. signup - You must have github accout
  2. checkout of project code (creation of new project via pasting github repo url)
Cloud9 IDE has some 'beta' bugs but it is usable now and can be used to develop Node.js applications.
You must be aware that Cloud9 IDE needs some specified values of host and port tu run code properly (more at the bottom).

  • git support (command line at the bottom)
  • runs Node.js code (like in Eclipse)
  • ACE code editor
  • Without support for npm
  • Without npm we can use only core Node.js, without frameworks
  • I'm not sure but I was unable to find any informations about database (let me now in comments if there is)

3: Hosting:

4: Example

//Cloud9 IDE to run Node.js needs
//to start server at specified host and port
HOST = "";
PORT = process.env.C9_PORT;

var http = require('http');
http.createServer(function (req, res){
    res.writeHead(200, {'Content-Type':'text/plain'});
    res.end('Hello World\n');
}).listen(PORT, HOST);

console.log('Server running at '+ HOST + ':' + PORT);

The same code from gist:


Popular posts from this blog

How to simulate slow connection (developer proxy in Node.js)

Update: If you use Chrome then you can use "Throttling" so simulate slow network for all your assets. This should be easier than proxy.

Toggle device modeChoose Network type.Refresh the page 


For some time I wanted to use some proxy for development and testing of eg. slow internet connection, but it was hard to find something useful and free. I know there is Charles but buy it to use it at most one in a month is not for me.

I started thinking about Node.js, maybe I can write proxy for me? But fortunately I found one.

With this module I can write really short code to create slow server:

var http = require('http'), httpProxy = require('http-proxy'); httpProxy.createServer(function (req, res, proxy) { var buffer = httpProxy.buffer(req); setTimeout(function () { proxy.proxyRequest(req, res, { host: 'localhost', port: 8080, …

Course Review: The Bitfountain iOS 8 with Swift Immersive

This is second big iOS learning project. For first one read iOS Programming book review. As I only have two of them done I have to compare them somehow.

I am mindful that it took me a really long time to finish it (since last autumn). For a couple of months this year I didn't even have the internet to learn it, so it could not be helped. But last half of the June I've spent watching the videos every day and managed to finish it before any new internet problems.

So how was it?
In my opinion, it's great if you're starting out. There are a lot of basics, and seeing how to do things in XCode just makes your learning much easier than looking at the photos in the book. On the other hand, learning is more shallow and it is much easier to just follow the videos and learn only the basics without bigger picture about iOS SDK. I somehow missed more challenging exercises (even though I don't like to do them ;)

Course it pretty long but many videos are quite short (1-2…