SlideShare une entreprise Scribd logo
1  sur  124
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

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

En vedette

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
 

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

Similaire à Getting started with developing Nodejs

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

Similaire à 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)
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Getting started with developing Nodejs