SlideShare a Scribd company logo
1 of 30
Download to read offline
Introduction to Node.js
–The Smiths
“When you say it's gonna happen "now"
Well when exactly do you mean?
See I've already waited too long
And all my hope is gone.”
2
3
“I hate almost all software…The only thing that matters
in software is the experience of the user. ”
-Ryan Dahl , Inventor of Node.js
http://tinyclouds.org/rant.html
1. What is Node.js?

2. How does it work?

3. What can I do with it?

4. Who is using it?

5. “Hello World!”

6. Resources Aaron Rosenberg
Mark Keith
4
Agenda
What is Node.js?
5
What is Node.js®?
• Server-side JavaScript platform
• Built on Google's V8 high performance Javascript runtime. The same one Chrome uses.
• NOT JavaScript, but rather a set of fast backend tools written in C/C++.
• Designed with an asynchronous architecture that works pretty much like your browser.
• An event-driven, non-blocking I/O model perfect for data-intensive, real-time applications
• A way to run javascript outside of your browser.
• The only way (I know of) to build web sites end-to-end using only one language.
• Used in production by top products and companies
• A growing community and platform
6
Web servers are old.
• 20 years of Web servers had
one general design: 

Receive a connection.

Accept a client request.

Return a response.

Shut down the connection.
• By the early-mid 2000s, web
applications were significantly
more interactive, complex and
real-time.

• Completely avoiding the old
“stateless” request-response
paradigm was hard.
REQUEST
RESPONSE
7
This guy got fed up.
In 2006, a web developer named Ryan Dahl
got hired to build a snowboarding website.
And he “got into this feature where users
could upload images.”
FEATURE: “How do you give people
feedback on how much of the file has been
uploaded?”
Meant doing two things at the same time, but
the server side of things was messy.
Why was it so hard to check what was
happening in another connection?
So in 2009, he created Node.js.
NOTE: There were and still are a lot of solutions to deal with
real-time applications, I/O and user concurrency. (Scala/
Java, Python/Twisted, Ruby EventMachine, PHP React &
Go). But doing those things wasn’t particularly easy then
(and still isn’t).
8
99
What if everything was non-blocking?
How do we make concurrent requests and responses easier?
What if you never waited for any IO to happen?
10
How does it work?
11
Node works like your browser.
• Node.js is built on top of
Google’s V8 JavaScript
runtime.
• V8 takes code you write in
JavaScript, compiles it into
machine code, and
executes it.
• Similar to browser, Node
has a bunch of helpers that
can do other stuff in parallel.
12
Application
APIs
Low Level I/O Stuff
Javascript
Google JavaScript Engine


DOM
AJAX
Network
Filesystem
DISCLAIMER: GROSS
OVER-SIMPLIFICATION!
The power of the asynchronous callback.
• I/O can still be a huge bottleneck for
servers.
• Special sauce of Node is ability for code to
go off to execute somewhere else to do it’s
thing, while the rest of your code
continues.
• Code is called an “asynchronous callback.”
• HIGH LEVEL

Asynchronous callbacks are functions that
can go off on their own, do some stuff and
come back when they are done. (It’s those
parallel helpers that make it happen.)
• Event Loop running all the time picks up
executed code and sends it back to you.
13
How your code works in the browser.
call stackcode BrowserAPIs
task queue
DOM (document)
ajax (XMLHTTPRequest)
SetTimeout
checkEmailAddress() {
containsATsymbol();
endsWithTLDomain();
};
checkEmailAddress();
checkEmailAddress()
containsATsymbol()
endsWithTLDomain()
14
onClick() onMouseover() onFocus()
event loop
Architecture diagram and stack animation credited to Philip Roberts.
How your code executes on a Node.js server.
call stackcode NodeAPIs
task queue
File System
Network
Process
formatEmailAddress()
15
saveEmailToDB() sendWelcomeEmail() checkLocalUbers()
…and much more!
event loop
CB saveEmailToDB();
CB sendWelcomeEmail();
formatEmailAddress();
The fast food analogy.
1. Order is given to a cashier
taking one order at a time. 

(call stack!)
2. After ordering, you step aside.
3. Helpers in the back then work
on part of your order
(callbacks!)
4. And drop it in the pick up area
when it’s done. (task queue!)
5. Food is picked up by the
cashier as it is ready. 

(event loop!)
16
Loupe Demo
latentflip.com/loupe/
17
What are some great uses for Node?
18
Where Node.js shines.
When real-time, two-way interactivity with lots of concurrent users is a
requirement, consider Node.js.
• Chat
• Data Streaming
• Monitoring Dashboards
• Team-based GPS Applications
• Integrations (JSON)
• Internet of Things - health monitors, sensors, thermostats, cars and “smart”
devices that need to talk to disparate data sources and services both in real-
time and offline.
19
But Node.js isn’t perfect.
REASON #1

When you need something more powerful than JS.
REASON #2

When I/O is not your problem.
Applications that need heavy server-side computational
processing or simple content delivery won’t take advantage
of the platform.
20
Popular packages available via Node.js (NPM)
• Express
• Async.js
• Request
• Browserify
• Grunt
• PM2
• Socket.IO
• Commander.js
• Mocha
• Bower
21
• Underscore
• UglifyJS2
• Cheerio
• Passport
• Nodemailer
• Hapi
• React
• Karma
• Pug
• Node MySQL
• MongoDB
• JSHint
• Morgan
• LESS
• WebPack
• Angular
• Restify
• Marked
• GraphicsMagick
• JSDom
*Top 30 NPM Packages for Node.js Developers 2016 https://colorlib.com/wp/npm-packages-node-js/
Popular text editors and IDEs (for Node)
• Cloud 9

https://c9.io/
• Intellij IDEA

https://www.jetbrains.com/idea/
• WebStorm

https://www.jetbrains.com/webstorm/
• Komodo IDE

www.activestate.com/komodo-ide
• Koding

https://koding.com/
22
• Eclipse

https://eclipse.org/
• WebMatrix

https://www.microsoft.com/web/webmatrix/
• Sublime Text

https://www.sublimetext.com/
• Atom

https://atom.io/
• Visual Studio Code

https://code.visualstudio.com/
Who is using it?
23
Small and relatively new, the community continues to grow.
24
Enterprise corporations using Node.js
25
Case Studies
UBER https://eng.uber.com/tech-stack-part-two/

• Uber’s core trip execution engine originally written in Node.js

• Mobile client router API written in Node.js

• Systems that handle pings from riders and drivers in real-time and then match them written
in Node.js and Go.

• Core of our web tech stack is built on top of Node.js 

EBAY & PAYPAL
• Moved production from Java to Node.js

• 2x as fast with fewer people

• 33% fewer lines of code

• 40% fewer files

LINKEDIN
• 20x faster

• Frontend and backend mobile teams combined into single unit

• Servers cut from 30 to 3. Enough headroom to handle 10x current capacity.

NETFLIX

• Shifted UI to Node.js

GODADDY

• Started prototyping in 2013. 

• Revamped entire backend to Node.js. 

• Increased hosting capabilities

• Handled same load with 10% of the hardware.

ATOM —> VS CODE

• Written with Node.js!
26
Hello World!
2727
Resources
28
Learning More About Node.js
Online Training
• Node Hero - Getting Started With Node.js Tutorial

https://blog.risingstack.com/node-hero-tutorial-getting-started-with-node-js/

• You Don't Know Node.js

https://github.com/azat-co/you-dont-know-node

Books
• Node.js Design Patterns

Blog Posts
• Understanding Stateful Web Connections Using JavaScript

https://www.meteor.com/articles/stateful-web-connections-with-meteor

• Why The Hell Would I Use Node.js? A Case-by-Case Tutorial

https://www.toptal.com/nodejs/why-the-hell-would-i-use-node-js

• Architecture of Node.js’ Internal Codebase

https://arenli.com/architecture-of-node-js-internal-codebase-57cd8376b71f

Videos
• What the Heck is an Event Loop Anyway by Philip Roberts @ JSConf EU 2014

https://www.youtube.com/watch?v=8aGhZQkoFbQ

• Ryan Dahl Interview, Node Summit 2012

https://www.youtube.com/watch?v=Fc26auhSLqM

29
30

More Related Content

What's hot

ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
Cyber Security Alliance
 
Testing Single Page Webapp
Testing Single Page WebappTesting Single Page Webapp
Testing Single Page Webapp
Akshay Mathur
 

What's hot (20)

Intro to Node.js (for .NET Developers)
Intro to Node.js (for .NET Developers)Intro to Node.js (for .NET Developers)
Intro to Node.js (for .NET Developers)
 
Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native
Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native
Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native
 
React native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in RomeReact native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in Rome
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPM
 
Node js
Node jsNode js
Node js
 
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
 
Nodejs getting started
Nodejs getting startedNodejs getting started
Nodejs getting started
 
Node
NodeNode
Node
 
Understand How Node.js and Core Features Works
Understand How Node.js and Core Features WorksUnderstand How Node.js and Core Features Works
Understand How Node.js and Core Features Works
 
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
 
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...
 
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
9 anti-patterns for node.js teams
9 anti-patterns for node.js teams9 anti-patterns for node.js teams
9 anti-patterns for node.js teams
 
Treinamento frontend
Treinamento frontendTreinamento frontend
Treinamento frontend
 
High Performance JavaScript - jQuery Conference SF Bay Area 2010
High Performance JavaScript - jQuery Conference SF Bay Area 2010High Performance JavaScript - jQuery Conference SF Bay Area 2010
High Performance JavaScript - jQuery Conference SF Bay Area 2010
 
Node.js with Express
Node.js with ExpressNode.js with Express
Node.js with Express
 
ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
ASFWS 2012 - Node.js Security – Old vulnerabilities in new dresses par Sven V...
 
Testing Single Page Webapp
Testing Single Page WebappTesting Single Page Webapp
Testing Single Page Webapp
 

Viewers also liked

Viewers also liked (20)

3Com 03-0237-600 B-1
3Com 03-0237-600 B-13Com 03-0237-600 B-1
3Com 03-0237-600 B-1
 
La cultura india
La cultura indiaLa cultura india
La cultura india
 
Historia de la_psicologia-alvarez_diaz_y_monroy_nars
Historia de la_psicologia-alvarez_diaz_y_monroy_narsHistoria de la_psicologia-alvarez_diaz_y_monroy_nars
Historia de la_psicologia-alvarez_diaz_y_monroy_nars
 
Maestría en Gestión Minera: Pronóstico del mercado minero de metales comunes ...
Maestría en Gestión Minera: Pronóstico del mercado minero de metales comunes ...Maestría en Gestión Minera: Pronóstico del mercado minero de metales comunes ...
Maestría en Gestión Minera: Pronóstico del mercado minero de metales comunes ...
 
Accidentes laborales
Accidentes laboralesAccidentes laborales
Accidentes laborales
 
La narrativa
La narrativaLa narrativa
La narrativa
 
Slide deck health check emr optimization 3 22 2017
Slide deck health check emr optimization 3 22 2017Slide deck health check emr optimization 3 22 2017
Slide deck health check emr optimization 3 22 2017
 
3Com 16-0340-000
3Com 16-0340-0003Com 16-0340-000
3Com 16-0340-000
 
Prezi media
Prezi mediaPrezi media
Prezi media
 
ASESORIA WEB EN PLATOS TIPICOS COLOMBIANOS
ASESORIA WEB EN PLATOS TIPICOS COLOMBIANOSASESORIA WEB EN PLATOS TIPICOS COLOMBIANOS
ASESORIA WEB EN PLATOS TIPICOS COLOMBIANOS
 
O PERFIL DO PROFESSOR DO SÉCULO XXI
O PERFIL DO PROFESSOR DO SÉCULO XXIO PERFIL DO PROFESSOR DO SÉCULO XXI
O PERFIL DO PROFESSOR DO SÉCULO XXI
 
Musica, espacio, naturaleza
Musica, espacio, naturalezaMusica, espacio, naturaleza
Musica, espacio, naturaleza
 
En la huerta de Sandra .
En la huerta de Sandra .En la huerta de Sandra .
En la huerta de Sandra .
 
ict
ictict
ict
 
Hidrelétrica e fontes alternativas
Hidrelétrica e fontes alternativasHidrelétrica e fontes alternativas
Hidrelétrica e fontes alternativas
 
Desperately Seeking… Something
Desperately Seeking… SomethingDesperately Seeking… Something
Desperately Seeking… Something
 
Design guidline for_small_waste_water_treatment_works
Design guidline for_small_waste_water_treatment_worksDesign guidline for_small_waste_water_treatment_works
Design guidline for_small_waste_water_treatment_works
 
Programa historia del_arte_3_2017
Programa historia del_arte_3_2017Programa historia del_arte_3_2017
Programa historia del_arte_3_2017
 
Access
AccessAccess
Access
 
Catuaba
CatuabaCatuaba
Catuaba
 

Similar to Introduction to Node.js

Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
Rob Davarnia
 

Similar to Introduction to Node.js (20)

Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
Node js
Node jsNode js
Node js
 
Real time web
Real time webReal time web
Real time web
 
Node azure
Node azureNode azure
Node azure
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
 
Proposal
ProposalProposal
Proposal
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
 
Node J pdf.docx
Node J pdf.docxNode J pdf.docx
Node J pdf.docx
 
Node J pdf.docx
Node J pdf.docxNode J pdf.docx
Node J pdf.docx
 
Nodejs
NodejsNodejs
Nodejs
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
Node.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivNode.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel Aviv
 
02 Node introduction
02 Node introduction02 Node introduction
02 Node introduction
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Nodejs
NodejsNodejs
Nodejs
 

Recently uploaded

Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
SofiyaSharma5
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Sheetaleventcompany
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
shivangimorya083
 

Recently uploaded (20)

VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 

Introduction to Node.js

  • 2. –The Smiths “When you say it's gonna happen "now" Well when exactly do you mean? See I've already waited too long And all my hope is gone.” 2
  • 3. 3 “I hate almost all software…The only thing that matters in software is the experience of the user. ” -Ryan Dahl , Inventor of Node.js http://tinyclouds.org/rant.html
  • 4. 1. What is Node.js? 2. How does it work? 3. What can I do with it? 4. Who is using it? 5. “Hello World!” 6. Resources Aaron Rosenberg Mark Keith 4 Agenda
  • 6. What is Node.js®? • Server-side JavaScript platform • Built on Google's V8 high performance Javascript runtime. The same one Chrome uses. • NOT JavaScript, but rather a set of fast backend tools written in C/C++. • Designed with an asynchronous architecture that works pretty much like your browser. • An event-driven, non-blocking I/O model perfect for data-intensive, real-time applications • A way to run javascript outside of your browser. • The only way (I know of) to build web sites end-to-end using only one language. • Used in production by top products and companies • A growing community and platform 6
  • 7. Web servers are old. • 20 years of Web servers had one general design: Receive a connection.
 Accept a client request.
 Return a response.
 Shut down the connection. • By the early-mid 2000s, web applications were significantly more interactive, complex and real-time. • Completely avoiding the old “stateless” request-response paradigm was hard. REQUEST RESPONSE 7
  • 8. This guy got fed up. In 2006, a web developer named Ryan Dahl got hired to build a snowboarding website. And he “got into this feature where users could upload images.” FEATURE: “How do you give people feedback on how much of the file has been uploaded?” Meant doing two things at the same time, but the server side of things was messy. Why was it so hard to check what was happening in another connection? So in 2009, he created Node.js. NOTE: There were and still are a lot of solutions to deal with real-time applications, I/O and user concurrency. (Scala/ Java, Python/Twisted, Ruby EventMachine, PHP React & Go). But doing those things wasn’t particularly easy then (and still isn’t). 8
  • 9. 99
  • 10. What if everything was non-blocking? How do we make concurrent requests and responses easier? What if you never waited for any IO to happen? 10
  • 11. How does it work? 11
  • 12. Node works like your browser. • Node.js is built on top of Google’s V8 JavaScript runtime. • V8 takes code you write in JavaScript, compiles it into machine code, and executes it. • Similar to browser, Node has a bunch of helpers that can do other stuff in parallel. 12 Application APIs Low Level I/O Stuff Javascript Google JavaScript Engine 
 DOM AJAX Network Filesystem DISCLAIMER: GROSS OVER-SIMPLIFICATION!
  • 13. The power of the asynchronous callback. • I/O can still be a huge bottleneck for servers. • Special sauce of Node is ability for code to go off to execute somewhere else to do it’s thing, while the rest of your code continues. • Code is called an “asynchronous callback.” • HIGH LEVEL
 Asynchronous callbacks are functions that can go off on their own, do some stuff and come back when they are done. (It’s those parallel helpers that make it happen.) • Event Loop running all the time picks up executed code and sends it back to you. 13
  • 14. How your code works in the browser. call stackcode BrowserAPIs task queue DOM (document) ajax (XMLHTTPRequest) SetTimeout checkEmailAddress() { containsATsymbol(); endsWithTLDomain(); }; checkEmailAddress(); checkEmailAddress() containsATsymbol() endsWithTLDomain() 14 onClick() onMouseover() onFocus() event loop Architecture diagram and stack animation credited to Philip Roberts.
  • 15. How your code executes on a Node.js server. call stackcode NodeAPIs task queue File System Network Process formatEmailAddress() 15 saveEmailToDB() sendWelcomeEmail() checkLocalUbers() …and much more! event loop CB saveEmailToDB(); CB sendWelcomeEmail(); formatEmailAddress();
  • 16. The fast food analogy. 1. Order is given to a cashier taking one order at a time. 
 (call stack!) 2. After ordering, you step aside. 3. Helpers in the back then work on part of your order (callbacks!) 4. And drop it in the pick up area when it’s done. (task queue!) 5. Food is picked up by the cashier as it is ready. 
 (event loop!) 16
  • 18. What are some great uses for Node? 18
  • 19. Where Node.js shines. When real-time, two-way interactivity with lots of concurrent users is a requirement, consider Node.js. • Chat • Data Streaming • Monitoring Dashboards • Team-based GPS Applications • Integrations (JSON) • Internet of Things - health monitors, sensors, thermostats, cars and “smart” devices that need to talk to disparate data sources and services both in real- time and offline. 19
  • 20. But Node.js isn’t perfect. REASON #1
 When you need something more powerful than JS. REASON #2
 When I/O is not your problem. Applications that need heavy server-side computational processing or simple content delivery won’t take advantage of the platform. 20
  • 21. Popular packages available via Node.js (NPM) • Express • Async.js • Request • Browserify • Grunt • PM2 • Socket.IO • Commander.js • Mocha • Bower 21 • Underscore • UglifyJS2 • Cheerio • Passport • Nodemailer • Hapi • React • Karma • Pug • Node MySQL • MongoDB • JSHint • Morgan • LESS • WebPack • Angular • Restify • Marked • GraphicsMagick • JSDom *Top 30 NPM Packages for Node.js Developers 2016 https://colorlib.com/wp/npm-packages-node-js/
  • 22. Popular text editors and IDEs (for Node) • Cloud 9
 https://c9.io/ • Intellij IDEA
 https://www.jetbrains.com/idea/ • WebStorm
 https://www.jetbrains.com/webstorm/ • Komodo IDE
 www.activestate.com/komodo-ide • Koding
 https://koding.com/ 22 • Eclipse
 https://eclipse.org/ • WebMatrix
 https://www.microsoft.com/web/webmatrix/ • Sublime Text
 https://www.sublimetext.com/ • Atom
 https://atom.io/ • Visual Studio Code
 https://code.visualstudio.com/
  • 23. Who is using it? 23
  • 24. Small and relatively new, the community continues to grow. 24
  • 26. Case Studies UBER https://eng.uber.com/tech-stack-part-two/ • Uber’s core trip execution engine originally written in Node.js • Mobile client router API written in Node.js • Systems that handle pings from riders and drivers in real-time and then match them written in Node.js and Go. • Core of our web tech stack is built on top of Node.js EBAY & PAYPAL • Moved production from Java to Node.js • 2x as fast with fewer people • 33% fewer lines of code • 40% fewer files LINKEDIN • 20x faster • Frontend and backend mobile teams combined into single unit • Servers cut from 30 to 3. Enough headroom to handle 10x current capacity. NETFLIX • Shifted UI to Node.js GODADDY • Started prototyping in 2013. • Revamped entire backend to Node.js. • Increased hosting capabilities • Handled same load with 10% of the hardware.
 ATOM —> VS CODE • Written with Node.js! 26
  • 29. Learning More About Node.js Online Training • Node Hero - Getting Started With Node.js Tutorial
 https://blog.risingstack.com/node-hero-tutorial-getting-started-with-node-js/ • You Don't Know Node.js
 https://github.com/azat-co/you-dont-know-node Books • Node.js Design Patterns Blog Posts • Understanding Stateful Web Connections Using JavaScript
 https://www.meteor.com/articles/stateful-web-connections-with-meteor • Why The Hell Would I Use Node.js? A Case-by-Case Tutorial
 https://www.toptal.com/nodejs/why-the-hell-would-i-use-node-js • Architecture of Node.js’ Internal Codebase
 https://arenli.com/architecture-of-node-js-internal-codebase-57cd8376b71f Videos • What the Heck is an Event Loop Anyway by Philip Roberts @ JSConf EU 2014
 https://www.youtube.com/watch?v=8aGhZQkoFbQ • Ryan Dahl Interview, Node Summit 2012
 https://www.youtube.com/watch?v=Fc26auhSLqM
 29
  • 30. 30