GitHub - applieddataconsultants/node-talk: Sample files for Node Introduction

Code Samples for NodeJS Intro

Here are some sample code pieces:

Blocking / Non-Blocking I/O

Blocking Example

An simple example of blocking I/O in C++.

Running the binary for the io.cpp program:

If that doesn't work you probably have to compile on your box:

Non-Blocking Example

The similar example of the above, with non-blocking I/O in Node.

TCP Chat Server

A simple TCP based chat server. To run:

Then load up chat clients other terminals using something like:

or if you have NetCat:

HTTP Server

A basic HTTP server in Node:

Then, in another terminal

Or just load it in a browser.

HTTP Chunked

A simple example of how chunked encoding works in Node:

Then, in another terminal