NodeJS

Node.js is a platform built on Chrome's Javascript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

http://www.nodejs.org/

SlackBuild Slackware64 14.0

Package 64 bit: node-0.10.12-x86_64-1_SBo.tgz

node-gyp

node-gyp is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js.

https://github.com/TooTallNate/node-gyp

Install with npm

Hello world gyp

Based on https://github.com/joyent/node/tree/master/test/addons/hello-world

Based on https://github.com/rvagg/node-addon-examples

{
  "targets": [
    {
      "target_name": "hello",
      "sources": [ "hello.cc" ]
    }
  ]
}

   1 #include <node.h>
   2 #include <v8.h>
   3 
   4 using namespace v8;
   5 
   6 Handle<Value> Method(const Arguments& args) {
   7   HandleScope scope;
   8   return scope.Close(String::New("world"));
   9 }
  10 
  11 void init(Handle<Object> exports) {
  12   exports->Set(String::NewSymbol("hello"),
  13       FunctionTemplate::New(Method)->GetFunction());
  14 }
  15 
  16 NODE_MODULE(hello, init)

   1 var addon = require('./build/Release/hello');
   2 
   3 console.log(addon.hello()); // 'world'
   4 

Javascript/NodeJS (last edited 2014-03-12 09:18:55 by bl7-66-176)