SlideShare a Scribd company logo
Introduction to Node.js®
Jitendra Kumar Patel
Saturday, January 31, 2015
Why node.js ?
“Node's goal is to
provide an easy
way to build
scalable Network
programs”
• Created by Ryan Dahl in 2009
• Development && maintenance sponsored by Joyent
• Licence MIT
• Last release : 0.10.31
• Based on Google V8 Engine
• +99 000 packages
About Node.js……
Success Stories…..
● Vert.x => Polygot programming
● Akka => Scala and Java
● Tornado => Python
● Libevent => C
● EventMachine => Ruby
Another project like Node.js….
● Another Web framework
● For beginner
● Multi-thread
Node.js not……
• Traditional desktop applications have a user interface wired up with
background logic
– user interfaces are based on Windows Forms, Jswing, WPF, Gtk, Qt, etc. and
dependant on operating system
• On the web user interfaces are standardized
– HTML for markup
– CSS for style
– JavaScript for dynamic content
• In the past proprietary technologies existed on the web, e.g. Adobe Flash,
ActiveX
– They are slowly dying
• Data is generated on the server, transferred to the client and displayed by
the browser
• Server Side technologies include PHP, JSP, ASP.net, Rails, Djanog, and
yes, also node.js
Development forthe Web….
● REST = REpresentational State Transfer
● Not new technology
● Architectural style for client-server
REST……
● General interface
● Scalability of component interface
● Reduce latency
● Encapsulate legacy system
Goals of REST……..
● GET
● POST
● PUT
● DELETE
HTTP Method……
● POST => Create
● GET => Read
● PUT => Update
● DELETE => Delete
HTTP Method with CRUD…..
● Non Blocking I/O
● V8 Javascript Engine
● Single Thread with Event Loop
● 40,025 modules
● Windows, Linux, Mac
● 1 Language for Frontend and Backend
● Active community
Why node.js ?
• Asynchronous i/o framework
• Core in c++ on top of v8
• Rest of it in javascript
• Swiss army knife for network Related stuffs
• Can handle thousands of Concurrent connections with Minimal
overhead (cpu/memory) on a single process
• It’s NOT a web framework, and it’s also NOT a language
What is node.js?
« A platform built on
Chrome's JavaScript runtime
for easily building fast,
scalable network
applications. »
http://nodejs.org/
• Friendly callbacks
• Ubiquitous
• No I/o Primitives
• One language to RULE them all
JavaScript is well known for client-side scripts running inside the browser
node.js is JavaScript running on the server-side
SSJS -> Server-Side JavaScript
Use a language you know
Use the same language for client side and server side
Why javascript ?!!!
JavaScript Engines……
• Perform asynchronous processing on single thread instead of classical multithread
processing, minimize overhead & latency, maximize scalability
• Scale horizontally instead of vertically
• Ideal for applications that serve a lot of requests but dont use/need lots of
computational power per request
• Not so ideal for heavy calculations, e.g. massive parallel computing
• Also: Less problems with concurrency
The idea behind node.js….
Node.js Event Loop
There are a couple of implications of this apparently very simple and basic model
• Avoid synchronous code at all costs because it blocks the event loop
• Which means: callbacks, callbacks, and more callbacks
Example :: Read data from file and show data
Blocking vs Non-Blocking……
● Read data from file
● Show data
● Do other tasks
var data = fs.readFileSync( “test.txt” );
console.log( data );
console.log( “Do other tasks” );
Blocking…..
● Read data from file
When read data completed, show data
● Do other tasks
fs.readFile( “test.txt”, function( err, data ) {
console.log(data);
});
Non-Blocking…… CallbackCallback
• Chat/Messaging
• Real-time Applications
• Intelligent Proxies
• High Concurrency Applications
• Communication Hubs
• Coordinators
When to use it ?
● Web application
● Websocket server
● Ad server
● Proxy server
● Streaming server
● Fast file upload client
● Any Real-time data apps
● Anything with high I/O
Node.js for….
• http://nodejs.org/ and Download tar.gz
• Extract to any directory
• $ ./configure && make install
Getting Started…..
Project informations
• Name
• Version
• Dependencies
• Licence
• Main file
Etc...
File package.json…..
● https://npmjs.org/
● # of modules = 1,21,943
Node.js Modules…..
$npm install <module name>
Install module…..
• var http = require(‘http’);
• var fs = require(‘fs’);
• var express = require(‘express’);
Using module…..
In NodeJS
Others modules…..
● express
● underscore
● request
● async
● mysql
Find more in npmjs.org…..
Favorite Modules…..
• IDEs for node.js
– online IDE like cloud9
– Eclipse with node.js plugins
– Visual Studio node.js Toolkit
– Jetbrains Webstorm
– lots of other IDEs: webmatrix, coderunner, Expresso, Atom, etc.
• Preferred : Jetbrains Webstorm & Visual Studio with node.js
Tools of the trade…..
http://expressjs.com
Express…
Middleware can:
• Execute any code.
• Make changes to the request and the response
objects.
• End the request-response cycle.
• Call the next middleware in the stack.
Express As Middleware
Express Middleware Modules….
● Inspire from Sinatra
● Fast
● Flexible
● Simple
Working with Express…..
• Release stable 0.10.36 (young)
• Lots of stuffs to look at
• Lots of half backed stuffs
• Retro compatibility???
• Bad at handling staticcontents
• Bad at handling binarycontents
• Hard to find organized and authoritative informations
Some Warnings…
Jitendra Kumar Patel
www.jitendrapatel.in
jitendra.patel@iiitb.org
@bewithjitendra
facebook.com/bewithjitendrapatel
Saturday, January 31, 2015
Introduction to node.js aka NodeJS

More Related Content

What's hot

Node js introduction
Node js introductionNode js introduction
Node js introduction
Joseph de Castelnau
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.jsBasic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.js
Gary Yeh
 
NodeJS ecosystem
NodeJS ecosystemNodeJS ecosystem
NodeJS ecosystem
Yukti Kaura
 
NodeJS Concurrency
NodeJS ConcurrencyNodeJS Concurrency
NodeJS Concurrency
pgriess
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
 
Nodejs getting started
Nodejs getting startedNodejs getting started
Nodejs getting started
Triet Ho
 
Understanding the Single Thread Event Loop
Understanding the Single Thread Event LoopUnderstanding the Single Thread Event Loop
Understanding the Single Thread Event Loop
TorontoNodeJS
 
Node.js concurrency
Node.js concurrencyNode.js concurrency
Node.js concurrency
Giacomo Fornari
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDD
Sudar Muthu
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialTom Croucher
 
Node js for enterprise
Node js for enterpriseNode js for enterprise
Node js for enterprise
ravisankar munusamy
 
Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013
Oscar Renalias
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
Amit Thakkar
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Vikash Singh
 
Node js Introduction
Node js IntroductionNode js Introduction
Node js Introduction
sanskriti agarwal
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
Marcus Frödin
 
Introduction Node.js
Introduction Node.jsIntroduction Node.js
Introduction Node.js
Erik van Appeldoorn
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developers
cacois
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 

What's hot (20)

Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.jsBasic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.js
 
NodeJS ecosystem
NodeJS ecosystemNodeJS ecosystem
NodeJS ecosystem
 
NodeJS Concurrency
NodeJS ConcurrencyNodeJS Concurrency
NodeJS Concurrency
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
 
Nodejs getting started
Nodejs getting startedNodejs getting started
Nodejs getting started
 
Understanding the Single Thread Event Loop
Understanding the Single Thread Event LoopUnderstanding the Single Thread Event Loop
Understanding the Single Thread Event Loop
 
Node.js concurrency
Node.js concurrencyNode.js concurrency
Node.js concurrency
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDD
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
 
Node js for enterprise
Node js for enterpriseNode js for enterprise
Node js for enterprise
 
Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Node js Introduction
Node js IntroductionNode js Introduction
Node js Introduction
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
Introduction Node.js
Introduction Node.jsIntroduction Node.js
Introduction Node.js
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developers
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
 

Viewers also liked

Django tech-talk
Django tech-talkDjango tech-talk
Django tech-talk
dtdannen
 
Django Framework and Application Structure
Django Framework and Application StructureDjango Framework and Application Structure
Django Framework and Application StructureSEONGTAEK OH
 
Building Pluggable Web Applications using Django
Building Pluggable Web Applications using DjangoBuilding Pluggable Web Applications using Django
Building Pluggable Web Applications using Django
Lakshman Prasad
 
An Overview of Models in Django
An Overview of Models in DjangoAn Overview of Models in Django
An Overview of Models in Django
Michael Auritt
 
Django best practices
Django best practicesDjango best practices
Django best practicesAdam Haney
 
Django Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python DevelopersDjango Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python Developers
Rosario Renga
 
A Basic Django Introduction
A Basic Django IntroductionA Basic Django Introduction
A Basic Django IntroductionGanga Ram
 
Django
DjangoDjango
2017 LSC Women's Basketball Championship Bracket
2017 LSC Women's Basketball Championship Bracket2017 LSC Women's Basketball Championship Bracket
2017 LSC Women's Basketball Championship Bracket
lscmedia
 
Continuous delivery with ant and salesfroce
Continuous delivery with ant and salesfroceContinuous delivery with ant and salesfroce
Continuous delivery with ant and salesfroce
Rosario Renga
 
2017 LSC Men's Basketball Championship Bracket
2017 LSC Men's Basketball Championship Bracket2017 LSC Men's Basketball Championship Bracket
2017 LSC Men's Basketball Championship Bracket
lscmedia
 
AAPG POSTERS - Evolution of the Mardin Uplift
AAPG POSTERS - Evolution of the Mardin UpliftAAPG POSTERS - Evolution of the Mardin Uplift
AAPG POSTERS - Evolution of the Mardin UpliftJoshua Doubek
 
Apex and design pattern
Apex and design patternApex and design pattern
Apex and design pattern
Rosario Renga
 
How to Start a Movement with Your Blog - with Gideon Shalwick
How to Start a Movement with Your Blog - with Gideon ShalwickHow to Start a Movement with Your Blog - with Gideon Shalwick
How to Start a Movement with Your Blog - with Gideon Shalwick
Leslie Samuel
 
Sejarah perkembangan komputer
Sejarah perkembangan komputerSejarah perkembangan komputer
Sejarah perkembangan komputer
Wahyu Dermawan
 
Extrait benchmark pratiques agiles dans les organisations
Extrait benchmark pratiques agiles dans les organisationsExtrait benchmark pratiques agiles dans les organisations
Extrait benchmark pratiques agiles dans les organisations
Francois Salazar
 
How to Become a Better Writer
How to Become a Better WriterHow to Become a Better Writer
How to Become a Better Writer
Leslie Samuel
 
What is the most popular activity in the UK? The answer may surprise you.
What is the most popular activity in the UK? The answer may surprise you. What is the most popular activity in the UK? The answer may surprise you.
What is the most popular activity in the UK? The answer may surprise you.
Ned Potter
 

Viewers also liked (20)

Django quickstart
Django quickstartDjango quickstart
Django quickstart
 
Django tech-talk
Django tech-talkDjango tech-talk
Django tech-talk
 
Django Framework and Application Structure
Django Framework and Application StructureDjango Framework and Application Structure
Django Framework and Application Structure
 
Building Pluggable Web Applications using Django
Building Pluggable Web Applications using DjangoBuilding Pluggable Web Applications using Django
Building Pluggable Web Applications using Django
 
An Overview of Models in Django
An Overview of Models in DjangoAn Overview of Models in Django
An Overview of Models in Django
 
Django best practices
Django best practicesDjango best practices
Django best practices
 
Django Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python DevelopersDjango Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python Developers
 
A Basic Django Introduction
A Basic Django IntroductionA Basic Django Introduction
A Basic Django Introduction
 
Django
DjangoDjango
Django
 
2017 LSC Women's Basketball Championship Bracket
2017 LSC Women's Basketball Championship Bracket2017 LSC Women's Basketball Championship Bracket
2017 LSC Women's Basketball Championship Bracket
 
Django
DjangoDjango
Django
 
Continuous delivery with ant and salesfroce
Continuous delivery with ant and salesfroceContinuous delivery with ant and salesfroce
Continuous delivery with ant and salesfroce
 
2017 LSC Men's Basketball Championship Bracket
2017 LSC Men's Basketball Championship Bracket2017 LSC Men's Basketball Championship Bracket
2017 LSC Men's Basketball Championship Bracket
 
AAPG POSTERS - Evolution of the Mardin Uplift
AAPG POSTERS - Evolution of the Mardin UpliftAAPG POSTERS - Evolution of the Mardin Uplift
AAPG POSTERS - Evolution of the Mardin Uplift
 
Apex and design pattern
Apex and design patternApex and design pattern
Apex and design pattern
 
How to Start a Movement with Your Blog - with Gideon Shalwick
How to Start a Movement with Your Blog - with Gideon ShalwickHow to Start a Movement with Your Blog - with Gideon Shalwick
How to Start a Movement with Your Blog - with Gideon Shalwick
 
Sejarah perkembangan komputer
Sejarah perkembangan komputerSejarah perkembangan komputer
Sejarah perkembangan komputer
 
Extrait benchmark pratiques agiles dans les organisations
Extrait benchmark pratiques agiles dans les organisationsExtrait benchmark pratiques agiles dans les organisations
Extrait benchmark pratiques agiles dans les organisations
 
How to Become a Better Writer
How to Become a Better WriterHow to Become a Better Writer
How to Become a Better Writer
 
What is the most popular activity in the UK? The answer may surprise you.
What is the most popular activity in the UK? The answer may surprise you. What is the most popular activity in the UK? The answer may surprise you.
What is the most popular activity in the UK? The answer may surprise you.
 

Similar to Introduction to node.js aka NodeJS

18_Node.js.ppt
18_Node.js.ppt18_Node.js.ppt
18_Node.js.ppt
KhalilSalhi7
 
18_Node.js.ppt
18_Node.js.ppt18_Node.js.ppt
18_Node.js.ppt
MaulikShah516542
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
Khaled Mosharraf
 
An Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows Azure
Troy Miles
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
Ganesh Kondal
 
NodeJS Presentation
NodeJS PresentationNodeJS Presentation
NodeJS Presentation
Faisal Shahzad Khan
 
Mini-Training: Node.js
Mini-Training: Node.jsMini-Training: Node.js
Mini-Training: Node.js
Betclic Everest Group Tech Team
 
A brief intro to nodejs
A brief intro to nodejsA brief intro to nodejs
A brief intro to nodejs
Jay Liu
 
Scalable server component using NodeJS & ExpressJS
Scalable server component using NodeJS & ExpressJSScalable server component using NodeJS & ExpressJS
Scalable server component using NodeJS & ExpressJS
Andhy Koesnandar
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
Tech in Asia ID
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A Primer
Naveen S.R
 
Node and Azure
Node and AzureNode and Azure
Node and Azure
Jason Gerard
 
Building Real-World Dojo Web Applications
Building Real-World Dojo Web ApplicationsBuilding Real-World Dojo Web Applications
Building Real-World Dojo Web ApplicationsAndrew Ferrier
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
orkaplan
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami Sayar
FITC
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
Rami Sayar
 

Similar to Introduction to node.js aka NodeJS (20)

18_Node.js.ppt
18_Node.js.ppt18_Node.js.ppt
18_Node.js.ppt
 
18_Node.js.ppt
18_Node.js.ppt18_Node.js.ppt
18_Node.js.ppt
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
An Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows Azure
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
 
NodeJS Presentation
NodeJS PresentationNodeJS Presentation
NodeJS Presentation
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
Node.js
Node.jsNode.js
Node.js
 
20120802 timisoara
20120802 timisoara20120802 timisoara
20120802 timisoara
 
Mini-Training: Node.js
Mini-Training: Node.jsMini-Training: Node.js
Mini-Training: Node.js
 
A brief intro to nodejs
A brief intro to nodejsA brief intro to nodejs
A brief intro to nodejs
 
Scalable server component using NodeJS & ExpressJS
Scalable server component using NodeJS & ExpressJSScalable server component using NodeJS & ExpressJS
Scalable server component using NodeJS & ExpressJS
 
Node
NodeNode
Node
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A Primer
 
Node and Azure
Node and AzureNode and Azure
Node and Azure
 
Building Real-World Dojo Web Applications
Building Real-World Dojo Web ApplicationsBuilding Real-World Dojo Web Applications
Building Real-World Dojo Web Applications
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami Sayar
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
 

More from JITENDRA KUMAR PATEL

Introduction-To-SMPC-Philips-Innovation-Campus-SecurityExploded
Introduction-To-SMPC-Philips-Innovation-Campus-SecurityExplodedIntroduction-To-SMPC-Philips-Innovation-Campus-SecurityExploded
Introduction-To-SMPC-Philips-Innovation-Campus-SecurityExploded
JITENDRA KUMAR PATEL
 
Improving-The-Round-Complexity-of-VSS-in-Point-To-Point-Networks
Improving-The-Round-Complexity-of-VSS-in-Point-To-Point-NetworksImproving-The-Round-Complexity-of-VSS-in-Point-To-Point-Networks
Improving-The-Round-Complexity-of-VSS-in-Point-To-Point-Networks
JITENDRA KUMAR PATEL
 
Glyph-Placement-Strategy
Glyph-Placement-StrategyGlyph-Placement-Strategy
Glyph-Placement-Strategy
JITENDRA KUMAR PATEL
 
Manufacturing Compromise The Emergence of Exploit-as-a-Service
Manufacturing Compromise The Emergence of Exploit-as-a-ServiceManufacturing Compromise The Emergence of Exploit-as-a-Service
Manufacturing Compromise The Emergence of Exploit-as-a-Service
JITENDRA KUMAR PATEL
 
Introduction to Web Server Security
Introduction to Web Server SecurityIntroduction to Web Server Security
Introduction to Web Server Security
JITENDRA KUMAR PATEL
 
Secure 2 Party AES
Secure 2 Party AESSecure 2 Party AES
Secure 2 Party AES
JITENDRA KUMAR PATEL
 
Docker meetup-jan-2015
Docker meetup-jan-2015Docker meetup-jan-2015
Docker meetup-jan-2015
JITENDRA KUMAR PATEL
 

More from JITENDRA KUMAR PATEL (7)

Introduction-To-SMPC-Philips-Innovation-Campus-SecurityExploded
Introduction-To-SMPC-Philips-Innovation-Campus-SecurityExplodedIntroduction-To-SMPC-Philips-Innovation-Campus-SecurityExploded
Introduction-To-SMPC-Philips-Innovation-Campus-SecurityExploded
 
Improving-The-Round-Complexity-of-VSS-in-Point-To-Point-Networks
Improving-The-Round-Complexity-of-VSS-in-Point-To-Point-NetworksImproving-The-Round-Complexity-of-VSS-in-Point-To-Point-Networks
Improving-The-Round-Complexity-of-VSS-in-Point-To-Point-Networks
 
Glyph-Placement-Strategy
Glyph-Placement-StrategyGlyph-Placement-Strategy
Glyph-Placement-Strategy
 
Manufacturing Compromise The Emergence of Exploit-as-a-Service
Manufacturing Compromise The Emergence of Exploit-as-a-ServiceManufacturing Compromise The Emergence of Exploit-as-a-Service
Manufacturing Compromise The Emergence of Exploit-as-a-Service
 
Introduction to Web Server Security
Introduction to Web Server SecurityIntroduction to Web Server Security
Introduction to Web Server Security
 
Secure 2 Party AES
Secure 2 Party AESSecure 2 Party AES
Secure 2 Party AES
 
Docker meetup-jan-2015
Docker meetup-jan-2015Docker meetup-jan-2015
Docker meetup-jan-2015
 

Recently uploaded

Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 

Recently uploaded (20)

Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 

Introduction to node.js aka NodeJS

  • 1. Introduction to Node.js® Jitendra Kumar Patel Saturday, January 31, 2015
  • 2. Why node.js ? “Node's goal is to provide an easy way to build scalable Network programs”
  • 3. • Created by Ryan Dahl in 2009 • Development && maintenance sponsored by Joyent • Licence MIT • Last release : 0.10.31 • Based on Google V8 Engine • +99 000 packages About Node.js……
  • 5. ● Vert.x => Polygot programming ● Akka => Scala and Java ● Tornado => Python ● Libevent => C ● EventMachine => Ruby Another project like Node.js….
  • 6. ● Another Web framework ● For beginner ● Multi-thread Node.js not……
  • 7. • Traditional desktop applications have a user interface wired up with background logic – user interfaces are based on Windows Forms, Jswing, WPF, Gtk, Qt, etc. and dependant on operating system • On the web user interfaces are standardized – HTML for markup – CSS for style – JavaScript for dynamic content • In the past proprietary technologies existed on the web, e.g. Adobe Flash, ActiveX – They are slowly dying • Data is generated on the server, transferred to the client and displayed by the browser • Server Side technologies include PHP, JSP, ASP.net, Rails, Djanog, and yes, also node.js Development forthe Web….
  • 8. ● REST = REpresentational State Transfer ● Not new technology ● Architectural style for client-server REST……
  • 9. ● General interface ● Scalability of component interface ● Reduce latency ● Encapsulate legacy system Goals of REST……..
  • 10. ● GET ● POST ● PUT ● DELETE HTTP Method……
  • 11. ● POST => Create ● GET => Read ● PUT => Update ● DELETE => Delete HTTP Method with CRUD…..
  • 12. ● Non Blocking I/O ● V8 Javascript Engine ● Single Thread with Event Loop ● 40,025 modules ● Windows, Linux, Mac ● 1 Language for Frontend and Backend ● Active community Why node.js ?
  • 13. • Asynchronous i/o framework • Core in c++ on top of v8 • Rest of it in javascript • Swiss army knife for network Related stuffs • Can handle thousands of Concurrent connections with Minimal overhead (cpu/memory) on a single process • It’s NOT a web framework, and it’s also NOT a language What is node.js? « A platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. » http://nodejs.org/
  • 14. • Friendly callbacks • Ubiquitous • No I/o Primitives • One language to RULE them all JavaScript is well known for client-side scripts running inside the browser node.js is JavaScript running on the server-side SSJS -> Server-Side JavaScript Use a language you know Use the same language for client side and server side Why javascript ?!!!
  • 16. • Perform asynchronous processing on single thread instead of classical multithread processing, minimize overhead & latency, maximize scalability • Scale horizontally instead of vertically • Ideal for applications that serve a lot of requests but dont use/need lots of computational power per request • Not so ideal for heavy calculations, e.g. massive parallel computing • Also: Less problems with concurrency The idea behind node.js….
  • 17. Node.js Event Loop There are a couple of implications of this apparently very simple and basic model • Avoid synchronous code at all costs because it blocks the event loop • Which means: callbacks, callbacks, and more callbacks
  • 18. Example :: Read data from file and show data Blocking vs Non-Blocking……
  • 19. ● Read data from file ● Show data ● Do other tasks var data = fs.readFileSync( “test.txt” ); console.log( data ); console.log( “Do other tasks” ); Blocking…..
  • 20. ● Read data from file When read data completed, show data ● Do other tasks fs.readFile( “test.txt”, function( err, data ) { console.log(data); }); Non-Blocking…… CallbackCallback
  • 21. • Chat/Messaging • Real-time Applications • Intelligent Proxies • High Concurrency Applications • Communication Hubs • Coordinators When to use it ?
  • 22. ● Web application ● Websocket server ● Ad server ● Proxy server ● Streaming server ● Fast file upload client ● Any Real-time data apps ● Anything with high I/O Node.js for….
  • 23. • http://nodejs.org/ and Download tar.gz • Extract to any directory • $ ./configure && make install Getting Started…..
  • 24. Project informations • Name • Version • Dependencies • Licence • Main file Etc... File package.json…..
  • 25. ● https://npmjs.org/ ● # of modules = 1,21,943 Node.js Modules…..
  • 26. $npm install <module name> Install module…..
  • 27. • var http = require(‘http’); • var fs = require(‘fs’); • var express = require(‘express’); Using module…..
  • 30. ● express ● underscore ● request ● async ● mysql Find more in npmjs.org….. Favorite Modules…..
  • 31. • IDEs for node.js – online IDE like cloud9 – Eclipse with node.js plugins – Visual Studio node.js Toolkit – Jetbrains Webstorm – lots of other IDEs: webmatrix, coderunner, Expresso, Atom, etc. • Preferred : Jetbrains Webstorm & Visual Studio with node.js Tools of the trade…..
  • 33. Middleware can: • Execute any code. • Make changes to the request and the response objects. • End the request-response cycle. • Call the next middleware in the stack. Express As Middleware
  • 35. ● Inspire from Sinatra ● Fast ● Flexible ● Simple Working with Express…..
  • 36. • Release stable 0.10.36 (young) • Lots of stuffs to look at • Lots of half backed stuffs • Retro compatibility??? • Bad at handling staticcontents • Bad at handling binarycontents • Hard to find organized and authoritative informations Some Warnings…