SlideShare a Scribd company logo
New Kid On The Block – Node.js


Joel Divekar
GM – Information Systems,
People Interactive (I) Pvt. Ltd.
Open Source Conference, Pune
23rd March, 2013
Node.js was developed by Ryan Dhal in 2009
   and the project is managed by Joyent
Node.js is ...

Server side JavaScript

    Event Driven

  Asynchronous I/O

  Single Threaded

    Lightweight
Node.js ...

High performance network application framework and can
easily handle thousands of concurrent connections with
minimum CPU / Memory Utilisation



Built on top of Google's V8 JavaScript engine used in
Chrome



Easy to build scalable network servers
Node.js is similar to ...


EventMachine in Ruby


Twisted in Python
I/O
Blocking I/O
var fs = require('fs');

var file1 = fs.readFileSync('File1.txt', 'utf­8');

console.log(“Reading File1.txt”);

var file2 = readFileSync('File2.txt', 'utf­8');

console.log(“Reading File2.txt”);

Non-Blocking I/O
var fs = require('fs');

fs.readFileSync('File1.txt', 'utf­8', function(err,data){

    console.log(“Reading File1.txt”)

});

fs.readFileSync('File2.txt', 'utf­8', function(err,data){

    console.log(“Reading File2.txt”)

});
I/O
Blocking I/O
Reading File1.txt took 10 ms
Reading File2.txt took 6 ms
Total time 16 ms




Non-Blocking I/O
Reading File1.txt took 10 ms
Reading File2.txt took 6 ms
Total time 10 ms
Callback
//callback after 2 seconds
setTimeout(function(){
    console.log(“World”);
}, 2000);
    console.log(“Hello”);
Node REPL
REPL : Read - Eval - Print - Loop
$ node

> a=[1,2,"3",'four',];

[ 1, 2, '3', 'four' ]

> a.forEach(function (v) {

... console.log(v);

... });

1

2

3

four

Undefined

> .exit
Node.js HTTP Server
var http = require("http");

http.createServer(function(req, res) {

req.on("end", function () {

res.writeHead(200, {'Content­Type' : 'text/plain'});

res.end('Your IP is ' + (req.headers['x­forwarded­for'] || 
   req.connection.remoteAddress) + '!') });

}).listen(8080);



console.log("Server accepting request on http://127.0.0.1:8080");
Node.js HTTP Server
var http = require("http");

http.createServer(function(req, res) {

req.on("end", function () {

res.writeHead(200, {'Content­Type' : 'text/plain'});

res.end('Your IP is ' + (req.headers['x­forwarded­for'] || 
   req.connection.remoteAddress) + '!') });

}).listen(8080);



console.log("Server accepting request on http://127.0.0.1:8080");
npm
npm is package manager for node.js, similar to RubyGems &
  Python easy_install


npm install <module_name>


Modules
Express – MVC framework
Socket.IO – Websocket Library
Who is using Node.js ...
Thanks a lot for your time …
    joel.divekar@gmail.com
 www.linkedin.com/in/joeldivekar
   joeldivekar.blogspot.com
 www.slideshare.net/JoelDivekar

More Related Content

PPTX
От sysV к systemd
PPTX
DUMP-2013 Serverside - О хранилище “Зебра” - Казаков Александр
ODP
LSA2 - 02 Namespaces
PPTX
Introduction to node js
PDF
My Sq Ldb Tut
DOC
Qtp wsh scripts examples
KEY
WebClusters, Redis
От sysV к systemd
DUMP-2013 Serverside - О хранилище “Зебра” - Казаков Александр
LSA2 - 02 Namespaces
Introduction to node js
My Sq Ldb Tut
Qtp wsh scripts examples
WebClusters, Redis

What's hot (20)

PDF
pam_container -- jeszcze lżejsza wirtualizacja
PDF
LSA2 - PostgreSQL
PDF
Quick Introduction to Node.js
PDF
MyAWR another mysql awr
PDF
Deep Visibility for Production Microservices
PPTX
vSRX automation 3: NAT
PPTX
Php Basics part 1
PDF
1 m+ qps on mysql galera cluster
PDF
Booting directly opensuse iso file by grub2 @ openSUSE Asia Summit2015
PDF
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
PDF
Gerenciando múltiplas versões do PostgreSQL com pgvm
ODP
LSA2 - 02 Control Groups
KEY
Building HTTP API's with NodeJS and MongoDB
PPTX
Unix- the process
PDF
Gitkata fish shell
PDF
Recent my sql_performance Test detail
ODP
Day 2-some fun coding
PDF
My sql fabric ha and sharding solutions
PDF
Nginx cache api delete
PDF
Joy of Unix
pam_container -- jeszcze lżejsza wirtualizacja
LSA2 - PostgreSQL
Quick Introduction to Node.js
MyAWR another mysql awr
Deep Visibility for Production Microservices
vSRX automation 3: NAT
Php Basics part 1
1 m+ qps on mysql galera cluster
Booting directly opensuse iso file by grub2 @ openSUSE Asia Summit2015
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
Gerenciando múltiplas versões do PostgreSQL com pgvm
LSA2 - 02 Control Groups
Building HTTP API's with NodeJS and MongoDB
Unix- the process
Gitkata fish shell
Recent my sql_performance Test detail
Day 2-some fun coding
My sql fabric ha and sharding solutions
Nginx cache api delete
Joy of Unix
Ad

Similar to New kid on the block node.js (20)

PPTX
Node.js Workshop - Sela SDP 2015
PPTX
KEY
Node.js - A practical introduction (v2)
ODP
Introduce about Nodejs - duyetdev.com
PDF
Node.js introduction
PDF
Tech io nodejs_20130531_v0.6
PPTX
Introduction to Node.js
PPTX
Intro to node and non blocking io
PPTX
PDF
Event driven programming -- Node.JS
PDF
Node.js introduction
PDF
Nodejs a-practical-introduction-oredev
PPTX
Introduction to node.js by jiban
PPT
Introducción y comandos en NodeJS slodte
PPT
Introduction to node.js aka NodeJS
PDF
Node.js Presentation
PPTX
An overview of node.js
PDF
Server Side Event Driven Programming
PPTX
introduction to node.js
PPT
Node.js Workshop - Sela SDP 2015
Node.js - A practical introduction (v2)
Introduce about Nodejs - duyetdev.com
Node.js introduction
Tech io nodejs_20130531_v0.6
Introduction to Node.js
Intro to node and non blocking io
Event driven programming -- Node.JS
Node.js introduction
Nodejs a-practical-introduction-oredev
Introduction to node.js by jiban
Introducción y comandos en NodeJS slodte
Introduction to node.js aka NodeJS
Node.js Presentation
An overview of node.js
Server Side Event Driven Programming
introduction to node.js
Ad

More from Joel Divekar (6)

PPTX
DevSecOps
PPTX
Ransomware - TAIT knowledge Series
PPTX
Blockchain Technology
PPT
Managing & securing your password
PPT
Building open source storage for enterprise
PPT
Deploying linux in enterprise
DevSecOps
Ransomware - TAIT knowledge Series
Blockchain Technology
Managing & securing your password
Building open source storage for enterprise
Deploying linux in enterprise

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Approach and Philosophy of On baking technology
PDF
KodekX | Application Modernization Development
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Empathic Computing: Creating Shared Understanding
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Review of recent advances in non-invasive hemoglobin estimation
sap open course for s4hana steps from ECC to s4
Approach and Philosophy of On baking technology
KodekX | Application Modernization Development
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The AUB Centre for AI in Media Proposal.docx
Empathic Computing: Creating Shared Understanding
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
Understanding_Digital_Forensics_Presentation.pptx
Unlocking AI with Model Context Protocol (MCP)
Spectral efficient network and resource selection model in 5G networks
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx

New kid on the block node.js