SlideShare ist ein Scribd-Unternehmen logo
1 von 38
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

Weitere ähnliche Inhalte

Was ist angesagt?

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.jsGary Yeh
 
NodeJS ecosystem
NodeJS ecosystemNodeJS ecosystem
NodeJS ecosystemYukti Kaura
 
NodeJS Concurrency
NodeJS ConcurrencyNodeJS Concurrency
NodeJS Concurrencypgriess
 
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 startedTriet Ho
 
Understanding the Single Thread Event Loop
Understanding the Single Thread Event LoopUnderstanding the Single Thread Event Loop
Understanding the Single Thread Event LoopTorontoNodeJS
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDDSudar Muthu
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialTom Croucher
 
Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013Oscar Renalias
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejsAmit Thakkar
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
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.jsMarcus Frödin
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developerscacois
 
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 azureColin Mackay
 

Was ist angesagt? (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
 

Andere mochten auch

Django tech-talk
Django tech-talkDjango tech-talk
Django tech-talkdtdannen
 
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 DjangoLakshman Prasad
 
An Overview of Models in Django
An Overview of Models in DjangoAn Overview of Models in Django
An Overview of Models in DjangoMichael 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 DevelopersRosario Renga
 
A Basic Django Introduction
A Basic Django IntroductionA Basic Django Introduction
A Basic Django IntroductionGanga Ram
 
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 Bracketlscmedia
 
Continuous delivery with ant and salesfroce
Continuous delivery with ant and salesfroceContinuous delivery with ant and salesfroce
Continuous delivery with ant and salesfroceRosario 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 Bracketlscmedia
 
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 patternRosario 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 ShalwickLeslie Samuel
 
Sejarah perkembangan komputer
Sejarah perkembangan komputerSejarah perkembangan komputer
Sejarah perkembangan komputerWahyu 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 organisationsFrancois Salazar
 
How to Become a Better Writer
How to Become a Better WriterHow to Become a Better Writer
How to Become a Better WriterLeslie 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
 

Andere mochten auch (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.
 

Ähnlich wie Introduction to node.js aka NodeJS

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 AzureTroy Miles
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Ganesh Kondal
 
A brief intro to nodejs
A brief intro to nodejsA brief intro to nodejs
A brief intro to nodejsJay Liu
 
Scalable server component using NodeJS & ExpressJS
Scalable server component using NodeJS & ExpressJSScalable server component using NodeJS & ExpressJS
Scalable server component using NodeJS & ExpressJSAndhy 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 PrimerNaveen S.R
 
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.jsorkaplan
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami SayarFITC
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101Rami Sayar
 

Ähnlich wie 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
 

Mehr von 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-SecurityExplodedJITENDRA 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-NetworksJITENDRA 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-ServiceJITENDRA KUMAR PATEL
 
Introduction to Web Server Security
Introduction to Web Server SecurityIntroduction to Web Server Security
Introduction to Web Server SecurityJITENDRA KUMAR PATEL
 

Mehr von 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
 

Kürzlich hochgeladen

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 

Kürzlich hochgeladen (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

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…