All posts from April 2010

Node by example

Node by example: 13. Links & Where to go from here

13. Links & Where to go from here

The complete source code can be downloaded here: http://github.com/Hendrik/node-by-example

Please note: Node.JS is still in active development, so that some articles may contain code that is no longer working with newer versions of Node.JS
During the time ...

Node by example

Node by example: 12. Sample Project

12. Sample Project

The complete source code can be downloaded here: http://github.com/Hendrik/node-by-example

The following is a sample project which displays your website visitors in real time on google maps using node with the geoip and websocket server modules.

Basically what the script does is to watch ...

Node by example

Node by example: 11. REPL

11. REPL

The complete source code can be downloaded here: http://github.com/Hendrik/node-by-example

A Read-Eval-Print-Loop is available both as a standalone program and easily includable in other programs. REPL provides a way to interactively run JavaScript and see the results. It can be used for debugging, testing, or ...

Node by example

Node by example: 10. addon modules

10. addon modules

The complete source code can be downloaded here: http://github.com/Hendrik/node-by-example

The examples in this chapter are meant to showcase extending node with some of the available third party modules.
Websockets (server & client), MySQL access and GeoIP are covered in this chapter.

i) GeoIP:
The ...

Node by example

Node by example: 9. multipart module

9. multipart module

The complete source code can be downloaded here: http://github.com/Hendrik/node-by-example

Please note: the multipart module was originally part of node, but has been removed in a previous release.
It is supposed to come back in an improved form, so that I will keep this ...

Node by example

Node by example: 8. HTTP module

8. HTTP module

The complete source code can be downloaded here: http://github.com/Hendrik/node-by-example

Node provides a module specifically for the http protocol. Use it via require('http').

As taken from the official documentation at http://nodejs.org/api.html#http-145:
The HTTP interfaces in Node are designed ...

Node by example

Node by example: 7. net module

7. net module

The complete source code can be downloaded here: http://github.com/Hendrik/node-by-example

With the release of node v0.1.91, the previously existing "tcp" module has been renamed to "net". It provides 2 main objects, net.Server, which is used to create a TCP or UNIX ...

Node by example

Node by example: 6. DNS Resolving

6. DNS Resolving

The complete source code can be downloaded here: http://github.com/Hendrik/node-by-example

The DNS module provides DNS resolving related features, such as IPv4 & IPv6 resolving, specific record types resolving and reverse resolving. [1]
Please note: even though the documentation mentions the lookup capability of MX record ...

Node by example

Node by example: 5. Child Process & File System

5. Child Process & File System

The complete source code can be downloaded here: http://github.com/Hendrik/node-by-example

Child Process: [1]
Please note:
at the time of this writing the api has changed and ChildProcess is now its own class, so please make sure you have the latest node version ...

Node by example

Node by example: 4. Basics

4. Basics

The complete source code can be downloaded here: http://github.com/Hendrik/node-by-example

Encodings:
Node.JS supports UTF-8 ("utf8"), ASCII ("ascii") and Binary ("binary").
ASCII and Binary are relatively fast, UTF-8 is slower and should be avoided when possible.

Globals: [1]
i) Arguments:
See 04_Basics/global.js:

var ...