SlideShare a Scribd company logo
Introduction to Node.js
  By
  Arun Kumar Arjunan,
  Product Architect,
  Chronus
AGENDA
• About Node.js

• Programming in Node.js

• Web Frameworks

• Node.js internals

• Popularity of Node.js

• Downside of Node.js
ABOUT NODE.JS




What is
Node.js?
ABOUT NODE.JS




 Node.js
Applications
node.js KO
NIDE
Chess@home
GITJS
GitJS is a pure JavaScript implementation
Of Git.
Example Commands:
• git.js log
• git.js branch
• git.js show SHA
NODECHAT
DEFINITION



    Node.js is an
   event-driven I/O
     server-side
JavaScript environment
AGENDA
• About Node.js

 Programming in Node.js

• Web Frameworks

• Node.js internals

• Popularity of Node.js

• Downside of Node.js
HELLO WORLD PROGRAM

Node.JS is a command line tool




 $ node hello-console.js
HTTP SERVER
FILE SYSTEM
OTHER LIBRARIES

• Timers    • DNS
• Events    • REPL
• Buffers   • Child Processes
• Streams   • ZLIB
• Crypto    • OS
• TLS/SSL
NODE IS EVENT DRIVEN




Did you notice that the previous
  examples use Event Driven
          technique?
NODE IS EVENT DRIVEN
NODE IS EVENT DRIVEN
NODE IS EVENT DRIVEN




$ ab –n 200 -c 50 http://localhost:8080/
NOW IN RUBY
 require 'rubygems'
 require 'mongrel'

 class HelloWorldHandler < Mongrel::HttpHandler
   def process(request, response)
     sleep a2
     response.start(200) do |head,out|
       head["Content-Type"] = "text/plain"
       out.write(“Hello World”)
     end
   end
 end

 h = Mongrel::HttpServer.new("127.0.0.1", "1337")
 h.register("/", HelloWorldHandler.new)
 h.run.join

$ ab –n 200 -c 50 http://localhost:1337/
EVENT DRIVEN VS THREADING



Lets compare Event Driven Programming
& Thread based programming!!!

 •   Some theory proves Threading model is better
 •   Some proves Event Driven Programming is better
EVENT DRIVEN VS THREADING




Lets take an example that is
      relevant to us!!!
APACHE VS NGINX
APACHE VS NGINX
APACHE VS NGINX

The difference?

Apache uses one thread per
connection.

NGINX doesn’t use threads. It uses
an event loop
Disadvantages of Threading

•   Context switching is not free
•   Execution stacks take up
    memory
•   For massive concurrency,
    cannot use an OS thread for
    each connection.
AGENDA
• About Node.js

• Programming in Node.js

 Web Frameworks

• Node.js internals

• Popularity of Node.js

• Downside of Node.js
NODE.JS COMMUNITY



   Node.js
has excellent
  community
NODE PACKAGE MANAGER




     NPM
Its like bundler for Ruby Gems
AROUND 60 TEMPLATE ENGINES

asyncEJS, bake, bind-js, blue, CoffeeKup, combyne.js,
doT.js, dust, Eco, ejs, haml.js, haml-js, jshtml, jqtpl,
Jade, jazz, JinJS, JSON Template, jm, jsdom, less.js,
Liquor, minimal.js, Mu, nTPL, nodejs-meta-templates,
normal-template, nun, node.magic_dom, node-template,
node-properties, Parrot, PURE, stencil, Node-T, Swig,
Templ8, template.node.js, tmpl-node, TwigJS, weld
WEB FRAMWEORKS




1. Geddy
2. ExpressJS
3. RailwayJS
RAILWAYJS



Quick guide to
 RailwayJS
   Its like Rails itself
ROUTES IN RAILWAYJS
CONTROLLERS IN RAILWAYJS
MODELS IN RAILWAYJS
AGENDA
• About Node.js

• Programming in Node.js

• Web Frameworks

• Node.js Internals

• Popularity of Node.js

• Downside of Node.js
NODE.JS ARCHITECTURE
ABOUT V8

•   V8 team is led by Lars Bak
•   Lars Bak was the technical lead behind HotSpot (Sun’s
    Java VM).
•   HotSpot improved Java’s performance 20x times
•   Before HotSpot Lars Bak worked on a Smalltalk VM
•   V8 uses hidden classes
UNDERSTANDING V8




  Lets try to
understand V8
UNDERSTANDING V8




• It is used to run JavaScript
• Can be embedded into any application
• Can expose C methods & Objects using
  JS interface
USING V8
USING V8
String::New(“a = 1; b = 2; a + b”)

$ ./hello-world

String::New(ARGV[1])

$./hello-world “a = 1; b = 2; a + b”

String::New(fread(ARGV[1]))

$./hello-world hello-world.js
NODE.JS ADVANTAGES




So Node.Js is nothing but a set
  of libraries using V8 engine
AGENDA
• About Node.js

• Programming in Node.js

• Web Frameworks

• Node.js Internals

• Popularity of Node.js

• Downside of Node.js
NODE.JS ADVANTAGES

•   Server side Javascript
•   Javascript is dynamic
•   Event based
•   Learning curve is less
•   Suited for event driven programming
•   Uses V8 which relatively faster
•   Uses CommonJS module spec
NODE.JS ADVANTAGES



Is the server side
    JavaScript
programming new?
SERVER SIDE JS FRAMEWORKS



• Helma - Rhino
• AppJet - Rhino
• Aptana Jaxer - SpiderMonkey
• CouchDB - SpiderMonkey
NODE.JS ADVANTAGES


     Is the
 Event Driven
programming new?
EVENT DRIVEN PROGRAMMING LANGUAGES



• E Programming language
• Event Driven MVC Framework for SmallTalk
• AmbientTalk
Similar Frameworks



• Event Machine for Ruby
• Libevent for C
• Twisted for Python
Conclusion




So why is Node.js so
      popular?
Conclusion



I think its because
Ryan Dhal put cool
 things together!!!
AGENDA
• About Node.js

• Programming in Node.js

• Web Frameworks

• Node.js Internals

• Popularity of Node.js

• Downside of Node.js
NODE.JS COMPLAINTS


• Programmers are used to synchronous code
• Exceptions are hard to handle
• Difficult to debug
• Most importantly it is not matured yet
• Doesn’t utilize multi-core CPU
Conclusion



FUTURE OF
 NODE.JS
   ???

More Related Content

What's hot (20)

PDF
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
PPTX
Node js Introduction
sanskriti agarwal
 
PPTX
Basic Concept of Node.js & NPM
Bhargav Anadkat
 
PPTX
Node js for enterprise
ravisankar munusamy
 
PPTX
Introduction to node.js
Dinesh U
 
PPTX
3 Things Everyone Knows About Node JS That You Don't
F5 Buddy
 
PPT
Node js
Chirag Parmar
 
PPT
Node.js an introduction
Meraj Khattak
 
PPTX
Nodejs getting started
Triet Ho
 
PPTX
Node.js tutoria for beginner
Maninder Singh
 
PDF
NodeJS
Predhin Sapru
 
PDF
Best node js course
bestonlinecoursescoupon
 
PPTX
Introduction to Node.js
Vikash Singh
 
PPTX
Node js introduction
Joseph de Castelnau
 
PPTX
Introduction to Node.js
Winston Hsieh
 
PDF
NodeJS ecosystem
Yukti Kaura
 
PDF
Node js (runtime environment + js library) platform
Sreenivas Kappala
 
PPT
Node
Manav Prasad
 
PPT
8 Most Effective Node.js Tools for Developers
iMOBDEV Technologies Pvt. Ltd.
 
PDF
Understanding the Single Thread Event Loop
TorontoNodeJS
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
Node js Introduction
sanskriti agarwal
 
Basic Concept of Node.js & NPM
Bhargav Anadkat
 
Node js for enterprise
ravisankar munusamy
 
Introduction to node.js
Dinesh U
 
3 Things Everyone Knows About Node JS That You Don't
F5 Buddy
 
Node js
Chirag Parmar
 
Node.js an introduction
Meraj Khattak
 
Nodejs getting started
Triet Ho
 
Node.js tutoria for beginner
Maninder Singh
 
Best node js course
bestonlinecoursescoupon
 
Introduction to Node.js
Vikash Singh
 
Node js introduction
Joseph de Castelnau
 
Introduction to Node.js
Winston Hsieh
 
NodeJS ecosystem
Yukti Kaura
 
Node js (runtime environment + js library) platform
Sreenivas Kappala
 
8 Most Effective Node.js Tools for Developers
iMOBDEV Technologies Pvt. Ltd.
 
Understanding the Single Thread Event Loop
TorontoNodeJS
 

Viewers also liked (12)

PDF
Bill Scott - GetJar
Mobile Monday Amsterdam
 
PPTX
From Hello World to Real World - Container Days Boston 2016
Shannon Williams
 
PPTX
introduction to node.js
orkaplan
 
PDF
Nodejs vatsal shah
Vatsal N Shah
 
PDF
Kicking Up the Dust with Node JS
Bill Scott
 
PPTX
Node js meetup
Ansuman Roy
 
KEY
Node.js ― Hello, world! の1歩先へ。
Tatsuya Tobioka
 
PDF
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 
PDF
EmpireJS: Hacking Art with Node js and Image Analysis
jeresig
 
PPTX
Introduction to Node js
Akshay Mathur
 
PDF
KrakenJS
PayPal
 
Bill Scott - GetJar
Mobile Monday Amsterdam
 
From Hello World to Real World - Container Days Boston 2016
Shannon Williams
 
introduction to node.js
orkaplan
 
Nodejs vatsal shah
Vatsal N Shah
 
Kicking Up the Dust with Node JS
Bill Scott
 
Node js meetup
Ansuman Roy
 
Node.js ― Hello, world! の1歩先へ。
Tatsuya Tobioka
 
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 
EmpireJS: Hacking Art with Node js and Image Analysis
jeresig
 
Introduction to Node js
Akshay Mathur
 
KrakenJS
PayPal
 
Ad

Similar to Introduction to node.js (20)

PPT
Node js beginner
Sureshreddy Nalimela
 
ODP
Introduce about Nodejs - duyetdev.com
Van-Duyet Le
 
PDF
Node.js Web Development .pdf
Abanti Aazmin
 
KEY
Dcjq node.js presentation
async_io
 
PPT
18_Node.js.ppt
KhalilSalhi7
 
PPT
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
PPT
18_Node.js.ppt
MaulikShah516542
 
PPTX
Take the Fastest Path to Node.Js Application Development with Bitnami & AWS L...
Bitnami
 
PPTX
Introduction to node.js GDD
Sudar Muthu
 
PDF
Hello world - intro to node js
Refresh Annapolis Valley
 
PPTX
Nodejs
Vinod Kumar Marupu
 
PPTX
Kalp Corporate Node JS Perfect Guide
Kalp Corporate
 
PPTX
Beginners Node.js
Khaled Mosharraf
 
PDF
An introduction to Node.js
Kasey McCurdy
 
PPTX
After the LAMP, it's time to get MEAN
Jeff Fox
 
PDF
NODE JS OC Meetup 1
eddify
 
PDF
Tech io nodejs_20130531_v0.6
Ganesh Kondal
 
PPTX
Node js
Fatih Şimşek
 
PPTX
An overview of node.js
valuebound
 
PPTX
Proposal
Constantine Priemski
 
Node js beginner
Sureshreddy Nalimela
 
Introduce about Nodejs - duyetdev.com
Van-Duyet Le
 
Node.js Web Development .pdf
Abanti Aazmin
 
Dcjq node.js presentation
async_io
 
18_Node.js.ppt
KhalilSalhi7
 
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
18_Node.js.ppt
MaulikShah516542
 
Take the Fastest Path to Node.Js Application Development with Bitnami & AWS L...
Bitnami
 
Introduction to node.js GDD
Sudar Muthu
 
Hello world - intro to node js
Refresh Annapolis Valley
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate
 
Beginners Node.js
Khaled Mosharraf
 
An introduction to Node.js
Kasey McCurdy
 
After the LAMP, it's time to get MEAN
Jeff Fox
 
NODE JS OC Meetup 1
eddify
 
Tech io nodejs_20130531_v0.6
Ganesh Kondal
 
An overview of node.js
valuebound
 
Ad

Recently uploaded (20)

PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 

Introduction to node.js