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

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)David Neal
 
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 Codemotion
 
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 RomeAlessandro Nadalin
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBhargav Anadkat
 
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 ...Edureka!
 
Nodejs getting started
Nodejs getting startedNodejs getting started
Nodejs getting startedTriet Ho
 
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 WorksHengki Sihombing
 
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...Demi Ben-Ari
 
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...Codemotion
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)Chris Cowan
 
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 teamsJeff Harrell
 
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 2010Nicholas Zakas
 
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 WebappAkshay 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

3Com 03-0237-600 B-1
3Com 03-0237-600 B-13Com 03-0237-600 B-1
3Com 03-0237-600 B-1savomir
 
La cultura india
La cultura indiaLa cultura india
La cultura indiaSole Blanco
 
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_narsPamela Yuli Quispe Chira
 
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 ...GERENS
 
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 2017HealthCo Information Systems
 
3Com 16-0340-000
3Com 16-0340-0003Com 16-0340-000
3Com 16-0340-000savomir
 
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 XXIMauricio Martinho
 
En la huerta de Sandra .
En la huerta de Sandra .En la huerta de Sandra .
En la huerta de Sandra .Rosa Vila
 
Desperately Seeking… Something
Desperately Seeking… SomethingDesperately Seeking… Something
Desperately Seeking… SomethingBarry Briggs
 
Programa historia del_arte_3_2017
Programa historia del_arte_3_2017Programa historia del_arte_3_2017
Programa historia del_arte_3_2017Federico Ruvituso
 

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 (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

A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一3sw2qly1
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 

Recently uploaded (20)

A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 

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