A C++ module boilerplate for Node.js
C++ JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src
.gitignore
README.md
test.js
wscript

README.md

Node C++ module boilerplate

This project is a gentle introduction to writing Node.js module in C++ I aim for the minimun amount of code necessary to build a working node module.

More examples to come.

What does it do?

The closest equivalent to this C++ Node.js module is :

function HelloWorld() {
    // Implicit "return this;"
}

HelloWorld.prototype.say = function say() {
    return new String("Hello world!");
};

Requirements

  • g++ (tested with v4.2)
  • node-waf *
  • node headers (node.h) *
  • v8 headers (v8.h) *
  • some C++ basic knowledge

* Comes with Node.js

How to build

Clone this repository, cd to it, then configure

$ node-waf configure

build

$ node-waf

and test

$ node test.js

You should see this:

HelloWorld // Name of the constructor
Hello world! // Return of HelloWorld.prototype.say

Read more

Todo

  • An example that actually does something meaningful
  • An example using libuv for non-blocking operations

Notes