SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
A MEGA-FAST INTRODUCTION TO
Kasey McCurdy
Director of Engineering @ Bunchball
A 10-MINUTE TOUR OF
JAVASCRIPT
JAVASCRIPT THEN…
• Developed in 1995 Netscape
to script it’s Navigator Browser
• Has zero* to do with Java
• Used in the early days of the
web to annoy the shit out of
people (and do things like form
validation, image rollovers, and
basic interactivity)
JAVASCRIPT NOW…
• Huge surge in popularity since 2005
thanks to countless innovations…
• Standardization (ECMA)
• Javascript libraries such as jQuery
• XHR / AJAX
• Better browsers powered by faster and
faster Javascript engines
JAVASCRIPT IS NOW QUITE POPULAR…
SO, WHAT MAKES JAVASCRIPT UNIQUE?
Loosely Typed
Object-based
Functions are First-Class
Functional Scoping
Can be asynchronous (demo)
ASYNCHRONOUS DEMO
VROOM.
THE V8 JAVASCRIPT ENGINE
• Developed by Google for the
Chrome browser in 2008
• Written in C++
• Compiles Javascript to
machine code before
execution vs. interpreting
the code
• Blew away the competition.
( 2008 Tests )
BECAUSE OF V8, WE HAVE NODE.JS
• Invented in 2009 by Ryan Dahl @ Joyent
• Uses the V8 Javascript engine at its core
• Node.js runtime contains core modules
that handle everything from HTTP, 

Filesystem I/O, Cryptography, etc.
• Browser-specific items taken out
(Document, Window, etc)
• This allows us to run Javascript
anywhere…the command line…the server…
hardware…anywhere…
• Writing Javascript everywhere is awesome.
AN OVERVIEW OF NODE.JS
• Create anything from command line utilities to lightweight API’s to
full-scale web applications.
• 3rd most popular project on GitHub
• Great for high-traffic applications,
• Not-so-great for high-CPU applications.
• Highly-active community
• Used (and endorsed) by many large corporations - Walmart, eBay,
Apple, etc…
NODE.JS SUCCESS STORIES
LinkedIn switched to Node.js from Rails for their mobile
traffic, reducing the number of servers from 30 to 3
(90% reduction) and the new system was up to 20x
faster.
PayPal are rolling out Node.js across their entire web
application and Node.js will be used almost everywhere
within 2 years.
On Black Friday, the Walmart servers didn’t go over 1%
CPU utilization and the team did a deploy in the middle
of the day with 200,000,000 users online.
For more companies and examples of Node.js in the wild: http://bit.ly/node-usage
NODE IS EVENT-DRIVEN
• Node runs on a single-threaded, non-blocking event loop.
• The event loop essentially contains a queue of callback functions.
• Once expensive operations like Disk I/O or DB connections are
finished, the callback function is executed.
• Radically different from blocking languages, like PHP.
SYNCHRONOUS ASYNCHRONOUS
BLOCKING NON-BLOCKING
NODE PACKAGE MANAGER
• Over 135,000 modules, extending the functionality of Node
• Everything from small utilities to full-fledged frameworks
• Comes bundled automatically with Node
• Provides for dependency management
• Easy to install a module: npm install moduleName
• Modules can be installed globally (with the “-g” flag) or embedded within
your project in the “node_modules” directory
• Modules can be used in a Node program using require(‘moduleName’)
PACKAGE.JSON
• Holds various metadata relevant to the
project (name, version, etc.)
• Used primarily for dependency-management
• Initialize an empty package.json file with
“npm init”
• Install dependencies for a project by running
“npm install” from the project root
• You can save dependencies to your project
automatically to package.json by typing 

“npm install <module> --save”
EVERYONE’S FAVORITE MODULE…
• Web application framework, designed for building single-page, multi-page,
and hybrid web applications
• Built on top of another framework called Connect
• Similar to Sinatra (a ruby framework), provides MVC capabilities
• Minimalist, yet full-featured
• Built-in support for routing & various HTTP handlers, configuration,
session management, and middleware
• Amazing community
MY FAVORITE MODULE…EXPRESS.JS
EXPRESS.JS : ROUTING
EXPRESS.JS : ROUTING
EXPRESS.JS : MIDDLEWARE
Middleware Overview
EXPRESS.JS : MIDDLEWARE
• Middleware is a pipeline of code that gets called before your
request handler
• Express applications are basically a bunch of middleware calls
• Middleware is a function with access to the request object
(req), the response object (res), and the next middleware in
line in the request-response cycle of an Express application,
commonly denoted by a variable named next
• 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.JS : MIDDLEWARE
Middleware Example
EXPRESS.JS : TEMPLATING
Templating Example
EXPRESS.JS : TEMPLATING
RANDOM THINGS TO BE AWARE OF…
• The pyramid of doom aka “callback hell” —
http://callbackhell.com 

(Async.js is one module that can help)
• Writing asynchronous code can be hard…you
have to think differently.
• Node.js vs. IO.js
• Node process can be kept alive with
modules like “Forever”
• Play around with free & easy hosting of Node
apps on Heroku
BONUS ROUND
MONGODB : WE DON’T NEED NO JOINS
• Document-oriented, NoSQL database
• Goodbye table-based relational database structures…Hello JSON-like
documents with dynamic schemas
• Highly performant when MongoDB’s awesome indexing support is used
• Highly available, with failover and replication built-in
• A natural fit for Node and Express applications
• Uses JSON for queries
• Did I mention no joins?
MONGODB : DOCUMENT-BASED
A sample document in mongoDB…notice the schema differences.
MONGODB : QUERY WITH JSON!
SQL Query
mongoDB Query
SELECT * FROM users WHERE last_name="gullion"
db.users.find({
"last_name": "gullion"
});
MONGODB : QUERY WITH JSON!
SQL Query
mongoDB Query
SELECT * FROM students WHERE GPA > 2.5 AND
major = "comp sci"
db.students.find({
"GPA": {
"$gt": 2.5
},
"major": "comp sci"
});
• Command-line utilities
• Real-time applications
• Apps with many concurrent users
• APIs
Good For:
• CPU-intensive apps
• Simple HTML websites
Not So Good For:
Node is not a framework, it is a platform.
IN SUMMARY…
• http://nodeschool.io/#workshoppers
• https://www.codeschool.com/courses/real-time-web-with-node-js
• http://www.slideshare.net/crashposition/fast-slim-correct-the-evolution-of-javascript
• https://medium.com/unexpected-token/10-weeks-of-node-js-after-10-years-of-php-
a352042c0c11
• https://devcenter.heroku.com/articles/getting-started-with-nodejs
FURTHER READING / RESOURCES…
• http://shop.oreilly.com/product/0636920032977.do
• http://www.manning.com/cantelon/
Books
Websites / Blogs
OK, LET’S CODE SOME NODE…
http://bit.ly/dmaccnode

Weitere ähnliche Inhalte

Was ist angesagt?

DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactChen-Tien Tsai
 
WebAssembly overview. KievJS meetup
WebAssembly overview. KievJS meetupWebAssembly overview. KievJS meetup
WebAssembly overview. KievJS meetupAlexandr Skachkov
 
MEAN Stack
MEAN StackMEAN Stack
MEAN StackDotitude
 
Nodejs - Building a RESTful API
Nodejs - Building a RESTful APINodejs - Building a RESTful API
Nodejs - Building a RESTful APISang Cù
 
Web development using nodejs
Web development using nodejsWeb development using nodejs
Web development using nodejsVaisakh Babu
 
Web assembly overview by Mikhail Sorokovsky
Web assembly overview by Mikhail SorokovskyWeb assembly overview by Mikhail Sorokovsky
Web assembly overview by Mikhail SorokovskyValeriia Maliarenko
 
Sugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a timeSugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a timeEinar Ingebrigtsen
 
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
 
Yahoo! scale Node.js
Yahoo! scale Node.jsYahoo! scale Node.js
Yahoo! scale Node.jsFabian Frank
 
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB
 
Building an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stackBuilding an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stackdivyapisces
 
MEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona WorkshopMEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona WorkshopValeri Karpov
 
Cloud App Develop
Cloud App DevelopCloud App Develop
Cloud App DevelopFin Chen
 

Was ist angesagt? (18)

MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
 
WebAssembly overview. KievJS meetup
WebAssembly overview. KievJS meetupWebAssembly overview. KievJS meetup
WebAssembly overview. KievJS meetup
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
 
Nodejs - Building a RESTful API
Nodejs - Building a RESTful APINodejs - Building a RESTful API
Nodejs - Building a RESTful API
 
Meanstack overview
Meanstack overviewMeanstack overview
Meanstack overview
 
Web development using nodejs
Web development using nodejsWeb development using nodejs
Web development using nodejs
 
Web assembly overview by Mikhail Sorokovsky
Web assembly overview by Mikhail SorokovskyWeb assembly overview by Mikhail Sorokovsky
Web assembly overview by Mikhail Sorokovsky
 
Let's server your Data
Let's server your DataLet's server your Data
Let's server your Data
 
Sugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a timeSugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a time
 
Node.js on Azure
Node.js on AzureNode.js on Azure
Node.js on Azure
 
Build App with Nodejs - YWC Workshop
Build App with Nodejs - YWC WorkshopBuild App with Nodejs - YWC Workshop
Build App with Nodejs - YWC Workshop
 
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
 
Yahoo! scale Node.js
Yahoo! scale Node.jsYahoo! scale Node.js
Yahoo! scale Node.js
 
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
 
Building an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stackBuilding an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stack
 
MEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona WorkshopMEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona Workshop
 
Cloud App Develop
Cloud App DevelopCloud App Develop
Cloud App Develop
 

Ähnlich wie An introduction to Node.js

Advanced Web Technology.pptx
Advanced Web Technology.pptxAdvanced Web Technology.pptx
Advanced Web Technology.pptxssuser35fdf2
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANJeff Fox
 
Meanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore ChandraMeanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore ChandraKishore Chandra
 
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 AvivRon Perlmuter
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS Ganesh Kondal
 
Top 10 frameworks of node js
Top 10 frameworks of node jsTop 10 frameworks of node js
Top 10 frameworks of node jsHabilelabs
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Ganesh Kondal
 
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
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleIT Arena
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)Chris Cowan
 
Rami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with DockerRami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with DockerWeb à Québec
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jibanJibanananda Sana
 
Intro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETAlan Hecht
 
FULL stack -> MEAN stack
FULL stack -> MEAN stackFULL stack -> MEAN stack
FULL stack -> MEAN stackAshok Raj
 
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachJDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachPROIDEA
 

Ähnlich wie An introduction to Node.js (20)

Advanced Web Technology.pptx
Advanced Web Technology.pptxAdvanced Web Technology.pptx
Advanced Web Technology.pptx
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
 
Meanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore ChandraMeanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore Chandra
 
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
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
 
Oracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node finalOracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node final
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Mini-Training: Node.js
Mini-Training: Node.jsMini-Training: Node.js
Mini-Training: Node.js
 
Top 10 frameworks of node js
Top 10 frameworks of node jsTop 10 frameworks of node js
Top 10 frameworks of node js
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
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
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
Rami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with DockerRami Sayar - Node microservices with Docker
Rami Sayar - Node microservices with Docker
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
Intro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NET
 
FULL stack -> MEAN stack
FULL stack -> MEAN stackFULL stack -> MEAN stack
FULL stack -> MEAN stack
 
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachJDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
 

Kürzlich hochgeladen

哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查ydyuyu
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Roommeghakumariji156
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理F
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsPriya Reddy
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样ayvbos
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsMonica Sydney
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfJOHNBEBONYAP1
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsMonica Sydney
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...kajalverma014
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理F
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...meghakumariji156
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查ydyuyu
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsMonica Sydney
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样ayvbos
 
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime BalliaBallia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Balliameghakumariji156
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsMonica Sydney
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 

Kürzlich hochgeladen (20)

哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girls
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime BalliaBallia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 

An introduction to Node.js

  • 1. A MEGA-FAST INTRODUCTION TO Kasey McCurdy Director of Engineering @ Bunchball
  • 2. A 10-MINUTE TOUR OF JAVASCRIPT
  • 3. JAVASCRIPT THEN… • Developed in 1995 Netscape to script it’s Navigator Browser • Has zero* to do with Java • Used in the early days of the web to annoy the shit out of people (and do things like form validation, image rollovers, and basic interactivity)
  • 4. JAVASCRIPT NOW… • Huge surge in popularity since 2005 thanks to countless innovations… • Standardization (ECMA) • Javascript libraries such as jQuery • XHR / AJAX • Better browsers powered by faster and faster Javascript engines
  • 5. JAVASCRIPT IS NOW QUITE POPULAR…
  • 6. SO, WHAT MAKES JAVASCRIPT UNIQUE? Loosely Typed Object-based Functions are First-Class Functional Scoping Can be asynchronous (demo)
  • 9. THE V8 JAVASCRIPT ENGINE • Developed by Google for the Chrome browser in 2008 • Written in C++ • Compiles Javascript to machine code before execution vs. interpreting the code • Blew away the competition. ( 2008 Tests )
  • 10. BECAUSE OF V8, WE HAVE NODE.JS • Invented in 2009 by Ryan Dahl @ Joyent • Uses the V8 Javascript engine at its core • Node.js runtime contains core modules that handle everything from HTTP, 
 Filesystem I/O, Cryptography, etc. • Browser-specific items taken out (Document, Window, etc) • This allows us to run Javascript anywhere…the command line…the server… hardware…anywhere… • Writing Javascript everywhere is awesome.
  • 11.
  • 12. AN OVERVIEW OF NODE.JS • Create anything from command line utilities to lightweight API’s to full-scale web applications. • 3rd most popular project on GitHub • Great for high-traffic applications, • Not-so-great for high-CPU applications. • Highly-active community • Used (and endorsed) by many large corporations - Walmart, eBay, Apple, etc…
  • 13. NODE.JS SUCCESS STORIES LinkedIn switched to Node.js from Rails for their mobile traffic, reducing the number of servers from 30 to 3 (90% reduction) and the new system was up to 20x faster. PayPal are rolling out Node.js across their entire web application and Node.js will be used almost everywhere within 2 years. On Black Friday, the Walmart servers didn’t go over 1% CPU utilization and the team did a deploy in the middle of the day with 200,000,000 users online. For more companies and examples of Node.js in the wild: http://bit.ly/node-usage
  • 14. NODE IS EVENT-DRIVEN • Node runs on a single-threaded, non-blocking event loop. • The event loop essentially contains a queue of callback functions. • Once expensive operations like Disk I/O or DB connections are finished, the callback function is executed. • Radically different from blocking languages, like PHP.
  • 16.
  • 17. NODE PACKAGE MANAGER • Over 135,000 modules, extending the functionality of Node • Everything from small utilities to full-fledged frameworks • Comes bundled automatically with Node • Provides for dependency management • Easy to install a module: npm install moduleName • Modules can be installed globally (with the “-g” flag) or embedded within your project in the “node_modules” directory • Modules can be used in a Node program using require(‘moduleName’)
  • 18. PACKAGE.JSON • Holds various metadata relevant to the project (name, version, etc.) • Used primarily for dependency-management • Initialize an empty package.json file with “npm init” • Install dependencies for a project by running “npm install” from the project root • You can save dependencies to your project automatically to package.json by typing 
 “npm install <module> --save”
  • 20. • Web application framework, designed for building single-page, multi-page, and hybrid web applications • Built on top of another framework called Connect • Similar to Sinatra (a ruby framework), provides MVC capabilities • Minimalist, yet full-featured • Built-in support for routing & various HTTP handlers, configuration, session management, and middleware • Amazing community MY FAVORITE MODULE…EXPRESS.JS
  • 24. EXPRESS.JS : MIDDLEWARE • Middleware is a pipeline of code that gets called before your request handler • Express applications are basically a bunch of middleware calls • Middleware is a function with access to the request object (req), the response object (res), and the next middleware in line in the request-response cycle of an Express application, commonly denoted by a variable named next • 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.
  • 28. RANDOM THINGS TO BE AWARE OF… • The pyramid of doom aka “callback hell” — http://callbackhell.com 
 (Async.js is one module that can help) • Writing asynchronous code can be hard…you have to think differently. • Node.js vs. IO.js • Node process can be kept alive with modules like “Forever” • Play around with free & easy hosting of Node apps on Heroku
  • 30. MONGODB : WE DON’T NEED NO JOINS • Document-oriented, NoSQL database • Goodbye table-based relational database structures…Hello JSON-like documents with dynamic schemas • Highly performant when MongoDB’s awesome indexing support is used • Highly available, with failover and replication built-in • A natural fit for Node and Express applications • Uses JSON for queries • Did I mention no joins?
  • 31. MONGODB : DOCUMENT-BASED A sample document in mongoDB…notice the schema differences.
  • 32. MONGODB : QUERY WITH JSON! SQL Query mongoDB Query SELECT * FROM users WHERE last_name="gullion" db.users.find({ "last_name": "gullion" });
  • 33. MONGODB : QUERY WITH JSON! SQL Query mongoDB Query SELECT * FROM students WHERE GPA > 2.5 AND major = "comp sci" db.students.find({ "GPA": { "$gt": 2.5 }, "major": "comp sci" });
  • 34. • Command-line utilities • Real-time applications • Apps with many concurrent users • APIs Good For: • CPU-intensive apps • Simple HTML websites Not So Good For: Node is not a framework, it is a platform. IN SUMMARY…
  • 35. • http://nodeschool.io/#workshoppers • https://www.codeschool.com/courses/real-time-web-with-node-js • http://www.slideshare.net/crashposition/fast-slim-correct-the-evolution-of-javascript • https://medium.com/unexpected-token/10-weeks-of-node-js-after-10-years-of-php- a352042c0c11 • https://devcenter.heroku.com/articles/getting-started-with-nodejs FURTHER READING / RESOURCES… • http://shop.oreilly.com/product/0636920032977.do • http://www.manning.com/cantelon/ Books Websites / Blogs
  • 36. OK, LET’S CODE SOME NODE… http://bit.ly/dmaccnode

Hinweis der Redaktion

  1. SHOW DEMO
  2. Note: node modules -> drupal modules (dependencies)
  3. DEMO: npm init installing a module with —save wipe out node_modules and do an npm install