SlideShare una empresa de Scribd logo
1 de 124
Descargar para leer sin conexión
yet another talk on
  node.js
 getting started


       @philhawksworth
what we’ll look at
       whaddizit?
   installation options
       hello world
  modules & frameworks
   deploying & hosting
   comet and beyond
assumptions
web development experience
   javascript knowledge
       unix, linux, osx
     not a nodejs ninja
whaddizit?
Evented I/O for
V8 Javascript
evented i-what now?
           c++
   v8 javascript engine
  server-side javascript
    single event loop
       non-blocking
useful knowledge
  strong javascript
   jQuery patterns
dangerous knowledge
     jQuery patterns
considerations
     how mature is it?
v0.0.1: early 2009, currently v.0.4.8

        who uses it?
        everyone is playing.
considerations
     how mature is it?
v0.0.1: early 2009, currently v.0.4.8

        who uses it?
        everyone is playing.

should I be scared of it?
        no. but be cautious.
ball-ache:
  stability
 rate of change
installation
  options
 build from source
      package
       ndistro
          n
from source
  clone source from github
    install dependancies
         xcode tools
configure, make, make install
package
ball-ache:
  stability
 rate of change
many versions
many versions
many versions
  ndistro & n
ndistro
node distribution toolkit
enables many
versions of node
http://github.com/visionmedia/ndistro
http://github.com/visionmedia/ndistro
local versions
for each project
n
install as a module
ball-ache
version stability
module stability
installing modules
      npm
node package manager
curl http://npmjs.org/install.sh | sh
$ npm install <package>
$ npm install n
$ npm install n@0.4.1
$ npm ls
!"# express@2.2.2
$ !"# connect@1.3.0
$ $ !"" mime@1.2.1
$ $ %"" qs@0.1.0
$ !"" mime@1.2.1
$ %"" qs@0.1.0
!"" n@0.4.1
%"" underscore@1.1.6
!"# express@2.2.2
$ !"# connect@1.3.0
$ $ !"" mime@1.2.1
$ $ %"" qs@0.1.0
$ !"" mime@1.2.1
$ %"" qs@0.1.0
!"" n@0.4.1
%"" underscore@1.1.6
$ npm update n
$ npm install n
$ npm update npm
n
while ndistro
 is for virtual
environments
while ndistro
  is for local
environments
n gives
 system wide
node versioning
$ n 0.2.6
$ n v0.3.3
download
configure
  make
  install
$ n ls
$ n
0.2.3
  0.2.6 --debug
  0.3.4
  0.3.5
ο 0.4.8
$ n use 0.4.8
what we’ll look at
       whaddizit?
   installation options
       hello world
  modules & frameworks
   deploying & hosting
   comet and beyond
hello world
app.js



         hello world
$ node app.js
$ ./bin/node app.js
$ n use 0.4.8 app.js
frameworks
     get a little help

        uri routing
   content negotiation
       templating
environment configuration
express
   the canonical web
development framework
    http://expressjs.com
templating
many ways to render
  your response
bootstrapping
  quick scaffolding
$ express
   --template
   --css
   --session
$ n use 0.4.8 app.js
deploying
where do I put this thing?

     self-managed
 amazon, linode, slicehost
       managed
        heroku, no.de
duostack
 automated, git-based
     deployment
     install via npm
manage dependancies
     via npm
limited versions of nodejs
server.js



        hello world
$ git init
$ git add
$ git commit -m ‘1st commit’
$ duostack create nodedemo
$ git push duostack master
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 416 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)

====   Duostack deploy received for nodedemo
====   Compiling app... done
       Compressed size is 4.0KB
====   Launching first instances.... done

====   App successfully deployed to
====   http://nodedemo.duostack.net
self-managed
amazon, linode, slicehost
deploying
       get it there
             git

      configure it
     install dependencies

get it up, and keep it up
           upstart
$ git clone project.git
$ cd project
$ ndistro
ndistro is really
 just the shell
replicates your
 environment
keeping it up
$ /etc/init.d/
http://upstart.ubuntu.com/
what we’ll look at
       whaddizit?
   installation options
       hello world
  modules & frameworks
   deploying & hosting
   comet and beyond
easy comet requests
    websockets
comet
long-lived http requests
javascript on the client
     asks, and listens
asks again, or takes action
websockets
more efficient low latency comms
supported in
modern browsers
Graceful degradation
WebSocket
  Adobe Flash Socket
    Ajax long polling
Ajax multipart streaming
     Forever Iframe
     JSONP Polling
but...
node is not just for realtime
staying in
  the loop
and finding out more
github wiki
github.com/joyent/node/wiki
irc
irc.freenode.net
     #node.js
github wiki
@ryah
@tjholowaychuk
    @isaacs
  @sh1mmer
ta!
hawksworx.com
@philhawksworth

Más contenido relacionado

La actualidad más candente

Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
Tom Croucher
 
Building servers with Node.js
Building servers with Node.jsBuilding servers with Node.js
Building servers with Node.js
ConFoo
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
Amit Thakkar
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
Tom Croucher
 

La actualidad más candente (20)

Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
Server Side Event Driven Programming
Server Side Event Driven ProgrammingServer Side Event Driven Programming
Server Side Event Driven Programming
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS Express
 
Node.js Explained
Node.js ExplainedNode.js Explained
Node.js Explained
 
Nodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsNodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web Applications
 
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
 
Building servers with Node.js
Building servers with Node.jsBuilding servers with Node.js
Building servers with Node.js
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
 
Node Architecture and Getting Started with Express
Node Architecture and Getting Started with ExpressNode Architecture and Getting Started with Express
Node Architecture and Getting Started with Express
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginners
 
Intro to node and non blocking io
Intro to node and non blocking ioIntro to node and non blocking io
Intro to node and non blocking io
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
Node ppt
Node pptNode ppt
Node ppt
 
Node.js Workshop - Sela SDP 2015
Node.js Workshop  - Sela SDP 2015Node.js Workshop  - Sela SDP 2015
Node.js Workshop - Sela SDP 2015
 

Destacado

NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MBNodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
David Wesst
 
Asynchronous I/O in NodeJS - new standard or challenges?
Asynchronous I/O in NodeJS - new standard or challenges?Asynchronous I/O in NodeJS - new standard or challenges?
Asynchronous I/O in NodeJS - new standard or challenges?
Dinh Pham
 
Top mobile internet trends feb11
Top mobile internet trends feb11Top mobile internet trends feb11
Top mobile internet trends feb11
Hope Hong
 
Pilonidaldisease 141115134308-conversion-gate01
Pilonidaldisease 141115134308-conversion-gate01Pilonidaldisease 141115134308-conversion-gate01
Pilonidaldisease 141115134308-conversion-gate01
Haliunaa Battulga
 

Destacado (20)

NodeJS: the good parts? A skeptic’s view (devnexus2014)
NodeJS: the good parts? A skeptic’s view (devnexus2014)NodeJS: the good parts? A skeptic’s view (devnexus2014)
NodeJS: the good parts? A skeptic’s view (devnexus2014)
 
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MBNodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
 
(C)NodeJS
(C)NodeJS(C)NodeJS
(C)NodeJS
 
NodeJS: the good parts? A skeptic’s view (oredev, oredev2013)
NodeJS: the good parts? A skeptic’s view (oredev, oredev2013)NodeJS: the good parts? A skeptic’s view (oredev, oredev2013)
NodeJS: the good parts? A skeptic’s view (oredev, oredev2013)
 
Why You Are Not Your Type's Type
Why You Are Not Your Type's TypeWhy You Are Not Your Type's Type
Why You Are Not Your Type's Type
 
Oxford Dogma catalog of handcrafted dog accessories
Oxford Dogma catalog of handcrafted dog accessoriesOxford Dogma catalog of handcrafted dog accessories
Oxford Dogma catalog of handcrafted dog accessories
 
Coulta Crosby Catalog
Coulta Crosby CatalogCoulta Crosby Catalog
Coulta Crosby Catalog
 
Asynchronous I/O in NodeJS - new standard or challenges?
Asynchronous I/O in NodeJS - new standard or challenges?Asynchronous I/O in NodeJS - new standard or challenges?
Asynchronous I/O in NodeJS - new standard or challenges?
 
Why Your 5-Year-Old is More Digital Than Most CMOs - Sean Miller, R/GA and J...
Why Your 5-Year-Old is More Digital Than Most CMOs -  Sean Miller, R/GA and J...Why Your 5-Year-Old is More Digital Than Most CMOs -  Sean Miller, R/GA and J...
Why Your 5-Year-Old is More Digital Than Most CMOs - Sean Miller, R/GA and J...
 
Testing NodeJS Security
Testing NodeJS SecurityTesting NodeJS Security
Testing NodeJS Security
 
I May Like You, But I'm Not In LIke With You - Chloe Gottlieb, R/GA
I May Like You, But I'm Not In LIke With You - Chloe Gottlieb, R/GAI May Like You, But I'm Not In LIke With You - Chloe Gottlieb, R/GA
I May Like You, But I'm Not In LIke With You - Chloe Gottlieb, R/GA
 
NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)
 
IT’S AN “M” WORLD - 9+1 Learnings to Build a Path to Success
IT’S AN “M” WORLD - 9+1 Learnings to Build a Path to SuccessIT’S AN “M” WORLD - 9+1 Learnings to Build a Path to Success
IT’S AN “M” WORLD - 9+1 Learnings to Build a Path to Success
 
Taking Hollywood Out of Production
Taking Hollywood Out of ProductionTaking Hollywood Out of Production
Taking Hollywood Out of Production
 
What got you here won't get you there
What got you here won't get you thereWhat got you here won't get you there
What got you here won't get you there
 
The Sports Fan in 2015 - Richard Ting and Kyle Bunch, R/GA
The Sports Fan in 2015 - Richard Ting and Kyle Bunch, R/GAThe Sports Fan in 2015 - Richard Ting and Kyle Bunch, R/GA
The Sports Fan in 2015 - Richard Ting and Kyle Bunch, R/GA
 
Top mobile internet trends feb11
Top mobile internet trends feb11Top mobile internet trends feb11
Top mobile internet trends feb11
 
¿POR QUÉ TANGO?
¿POR QUÉ TANGO?¿POR QUÉ TANGO?
¿POR QUÉ TANGO?
 
Pilonidaldisease 141115134308-conversion-gate01
Pilonidaldisease 141115134308-conversion-gate01Pilonidaldisease 141115134308-conversion-gate01
Pilonidaldisease 141115134308-conversion-gate01
 
Word of-mouth
Word of-mouthWord of-mouth
Word of-mouth
 

Similar a Getting started with developing Nodejs

Webconf nodejs-production-architecture
Webconf nodejs-production-architectureWebconf nodejs-production-architecture
Webconf nodejs-production-architecture
Ben Lin
 

Similar a Getting started with developing Nodejs (20)

introduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraformintroduction-infra-as-a-code using terraform
introduction-infra-as-a-code using terraform
 
Dcjq node.js presentation
Dcjq node.js presentationDcjq node.js presentation
Dcjq node.js presentation
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
Open shift
Open shiftOpen shift
Open shift
 
Webconf nodejs-production-architecture
Webconf nodejs-production-architectureWebconf nodejs-production-architecture
Webconf nodejs-production-architecture
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
Boxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of LaptopsBoxen: How to Manage an Army of Laptops
Boxen: How to Manage an Army of Laptops
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
 
Node.js vs Play Framework
Node.js vs Play FrameworkNode.js vs Play Framework
Node.js vs Play Framework
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
Node js presentation
Node js presentationNode js presentation
Node js presentation
 
S&T What I know about Node 110817
S&T What I know about Node 110817S&T What I know about Node 110817
S&T What I know about Node 110817
 
Node.js - The New, New Hotness
Node.js - The New, New HotnessNode.js - The New, New Hotness
Node.js - The New, New Hotness
 
우리가 모르는 노드로 할 수 있는 몇가지
우리가 모르는 노드로 할 수 있는 몇가지우리가 모르는 노드로 할 수 있는 몇가지
우리가 모르는 노드로 할 수 있는 몇가지
 
[H3 2012] 우리가 모르는 Node.js로 할 수 있는 몇가지
[H3 2012] 우리가 모르는 Node.js로 할 수 있는 몇가지[H3 2012] 우리가 모르는 Node.js로 할 수 있는 몇가지
[H3 2012] 우리가 모르는 Node.js로 할 수 있는 몇가지
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Getting started with developing Nodejs