node.js
      Jakub Nesetril
jakub.nesetril@gmail.com
Who Are You?
Who Are You?

• JS
Who Are You?

• JS
• Ruby
Who Are You?

• JS
• Ruby
• web
Who Are You?

• JS
• Ruby
• web
• what real language do you speak?
TOC
TOC

• blocking vs. non-blocking intro
TOC

• blocking vs. non-blocking intro
• short introduction to node.js
TOC

• blocking vs. non-blocking intro
• short introduction to node.js
• examples
TOC

• blocking vs. non-blocking intro
• short introduction to node.js
• examples
• Q&A
Tags
Tags
• #javascript , #v8 , #ssjs
Tags
• #javascript , #v8 , #ssjs
• #event-oriented
Tags
• #javascript , #v8 , #ssjs
• #event-oriented
• #high-performance
Tags
• #javascript , #v8 , #ssjs
• #event-oriented
• #high-performance
• #asynchronous , #non-blocking
Tags
• #javascript , #v8 , #ssjs
• #event-oriented
• #high-performance
• #asynchronous , #non-blocking
• #low-level
Tags
• #javascript , #v8 , #ssjs
• #event-oriented
• #high-performance
• #asynchronous , #non-blocking
• #low-level
• #fun!
What’s missing?
Tags
• #javascript , #v8 , #ssjs
• #event-oriented
• #high-performance
• #asynchronous , #non-blocking
• #low-level
• #stable , #mature (not!)
(non-) Blocking IO
(non-) Blocking IO


• var rows = db.query(“SELECT * FROM…)
(non-) Blocking IO


• var rows = db.query(“SELECT * FROM…)
• rows.forEach…
(non-) Blocking IO


• db.query(“SELECT * FROM…”,
    function(rows) { rows.forEach… });
Why isn’t everybody
     doing it?
Why isn’t everybody
      doing it?
• non-blocking can be hard
Why isn’t everybody
      doing it?
• non-blocking can be hard
• JS is an ideal language / community for this
Why isn’t everybody
      doing it?
• non-blocking can be hard
• JS is an ideal language / community for this
• Ajax / DOM has taught events to millions
  of people
Why isn’t everybody
      doing it?
• non-blocking can be hard
• JS is an ideal language / community for this
• Ajax / DOM has taught events to millions
  of people
• node.js = network servers in JS
Example 1
Design Principles
Design Principles
• non-blocking - every IO must take callback
Design Principles
• non-blocking - every IO must take callback
• API should be familiar to client-side JS
  programmers ans old school UNIX hackers
Design Principles
• non-blocking - every IO must take callback
• API should be familiar to client-side JS
  programmers ans old school UNIX hackers
• built-in support for HTTP, DNS, TLS
Design Principles
• non-blocking - every IO must take callback
• API should be familiar to client-side JS
  programmers ans old school UNIX hackers
• built-in support for HTTP, DNS, TLS
• support advanced features (chunked
  encoding, pipelining, hanging requests for
  websockets etc.)
Example 2
Ecosystem
Ecosystem

• node modules (CommonJS)
Ecosystem

• node modules (CommonJS)
• npm
Ecosystem

• node modules (CommonJS)
• npm
• connect & express
Ecosystem

• node modules (CommonJS)
• npm
• connect & express
• node-inspector
Ecosystem

• node modules (CommonJS)
• npm
• connect & express
• node-inspector
• bounce
Advanced Topics
Advanced Topics

• WebSockets
Advanced Topics

• WebSockets
• Server-side DOM
Advanced Topics

• WebSockets
• Server-side DOM
• Performance
Advanced Topics

• WebSockets
• Server-side DOM
• Performance
• Hosting
NodeKnockout
Q&A

Introduction to node.js

Editor's Notes

  • #26 Example 0 - async switch lines and test
  • #31 Example 1 - server Example 2 - dns show node API docs
  • #32 modules example, node modules, npm
  • #33 modules example, node modules, npm
  • #34 modules example, node modules, npm
  • #35 modules example, node modules, npm
  • #36 modules example, node modules, npm
  • #41 Scrabbly (http://scrabb.ly/), Swarmnation (http://swarmation.com/), Serrano (http://starcraft2destroyedmymarrage.no.de/)