Node is 
● Open source. 
● Cross-platform. 
● Event-driven. 
● Non-blocking I/O.
Built on V8 
● JavaScript engine for 
Chrome. 
● written in C++. 
● V8 can run standalone, or 
can be embedded into any 
C++ application.
History 
● Created for Linux use in 
2009. 
● By Ryan Dahl 
● Sponsored by Joyent.
Non Blocking IO - Event Loop
Hello World 
setTimeout(function(){ 
console.log('world'); 
},2000); 
console.log('Hello'); 
process.stdin.on('data', function 
(chunk) { 
process.stdout.write('data: ' + 
chunk); 
}); 
● Non-blocking IO needs 
different mindset and 
coding style. 
● You are organizing your 
code around events. 
● Nobody can tell the exact 
sequence of execution 
especially for IO events.
Callback could be a hell 
fs.readFile(my.json', function(err, data) { 
var info = JSON.parse(data); 
db.findOne({id: info.id}, function(err, record) { 
fs.writeFile('my.txt', record.title, function(){ 
console.log('Finish job'); 
}) 
}) 
});
Http Server 
var http = require('http'); 
Import module 
http.createServer(function (request, response) { 
Use module 
response.writeHead(200, {'Content-Type': 'text/plain'}); 
response.end('Hello Worldn'); 
}).listen(8124); 
console.log('Server running at http://127.0.0.1:8124/');
Create Module 
exports.test = function(){ 
console.log("Hi I'm inside 
the test module"); 
} 
● Use exports object to 
externalize function, 
object or class 
● User require function to 
import module into your 
code. 
var module = require('./test2.js'); 
module.test();
Package Manager - npm 
● NPM is the package manager for the 
Node JavaScript platform 
● It puts modules in place so that node 
can find them. 
● Reads all project dependencies from 
package.json 
● Main commands are init, install, link, ls, 
and search. 
{ 
"name": "NewProject", 
"version": "0.0.1", 
"description": "showcase project", 
"main": "index.js", 
"scripts": { 
"test": "node index.js" 
}, 
"keywords": [ 
"new", 
"project" 
], 
"author": "matef", 
"license": "BSD-2-Clause" 
}
Frameworks - ExpressJS 
● Express is a minimal and flexible 
Node.js web application 
framework. 
● Express enables developer to 
organize artifacts and routes and 
views in a simple way. 
● Express has a generator tool that 
build the typical structure for 
simple web project.
IBM® Bluemix™ 
● IBM® Bluemix™ is the IBM open cloud 
platform. 
● Bluemix™ supports Nodejs as one of its 
runtimes. 
● Bluemix™ provides boilerplates for faster 
development start.
Some 
insight into 
Nodejs ...
It is the next big 
thing … catch up :)

Nodejs

  • 2.
    Node is ●Open source. ● Cross-platform. ● Event-driven. ● Non-blocking I/O.
  • 3.
    Built on V8 ● JavaScript engine for Chrome. ● written in C++. ● V8 can run standalone, or can be embedded into any C++ application.
  • 4.
    History ● Createdfor Linux use in 2009. ● By Ryan Dahl ● Sponsored by Joyent.
  • 5.
    Non Blocking IO- Event Loop
  • 6.
    Hello World setTimeout(function(){ console.log('world'); },2000); console.log('Hello'); process.stdin.on('data', function (chunk) { process.stdout.write('data: ' + chunk); }); ● Non-blocking IO needs different mindset and coding style. ● You are organizing your code around events. ● Nobody can tell the exact sequence of execution especially for IO events.
  • 7.
    Callback could bea hell fs.readFile(my.json', function(err, data) { var info = JSON.parse(data); db.findOne({id: info.id}, function(err, record) { fs.writeFile('my.txt', record.title, function(){ console.log('Finish job'); }) }) });
  • 8.
    Http Server varhttp = require('http'); Import module http.createServer(function (request, response) { Use module response.writeHead(200, {'Content-Type': 'text/plain'}); response.end('Hello Worldn'); }).listen(8124); console.log('Server running at http://127.0.0.1:8124/');
  • 9.
    Create Module exports.test= function(){ console.log("Hi I'm inside the test module"); } ● Use exports object to externalize function, object or class ● User require function to import module into your code. var module = require('./test2.js'); module.test();
  • 10.
    Package Manager -npm ● NPM is the package manager for the Node JavaScript platform ● It puts modules in place so that node can find them. ● Reads all project dependencies from package.json ● Main commands are init, install, link, ls, and search. { "name": "NewProject", "version": "0.0.1", "description": "showcase project", "main": "index.js", "scripts": { "test": "node index.js" }, "keywords": [ "new", "project" ], "author": "matef", "license": "BSD-2-Clause" }
  • 11.
    Frameworks - ExpressJS ● Express is a minimal and flexible Node.js web application framework. ● Express enables developer to organize artifacts and routes and views in a simple way. ● Express has a generator tool that build the typical structure for simple web project.
  • 12.
    IBM® Bluemix™ ●IBM® Bluemix™ is the IBM open cloud platform. ● Bluemix™ supports Nodejs as one of its runtimes. ● Bluemix™ provides boilerplates for faster development start.
  • 13.
    Some insight into Nodejs ...
  • 14.
    It is thenext big thing … catch up :)