Node.js:
The Good Parts
There's a new kid in town;
time to say hello.
Brought to you by @rockbot
Slide 2
Slide 2 text
Welcome to the Playground
(Ruby)
(Python)
Scheme
Go
Erlang
Clojure
(JavaScript)
(PHP)
(C#)
Slide 3
Slide 3 text
Node === Awesomesauce
○ Quick
○ Independent
○ Familiar
○ Modular
○ Plays well with others
○ MVP of MVC
○ Widely used
○ Super easy to get started
Slide 4
Slide 4 text
Fast and Asynchronous
Powered by the V8 JavaScript Engine
Evented, non-blocking I/O
Slide 5
Slide 5 text
Single Thread, Non-Blocking
Time
Blocking Non-Blocking
Slide 6
Slide 6 text
Single Thread, Non-Blocking
Time
Multi-Threaded,
Blocking
Non-Blocking
Slide 7
Slide 7 text
Everywhere You Want to Be
It's just JavaScript!
Easy context switching between
front-end and backend
Slide 8
Slide 8 text
Party with npm
modules : node :: gems : ruby
lots of small, modular packages that
can be added to programs via require
Slide 9
Slide 9 text
Use it Your Way
Favorite DBs:
○ MongoDB
○ CouchDB
○ MySQL
○ and more!
Preprocessors:
○ Jade (HTML)
○ Stylus (CSS)
○ ERB
○ Sass
Slide 10
Slide 10 text
Model-View-Controller?
Totally!
Customize your experience with a
framework like Express or Flatiron to
help organize your code
Slide 11
Slide 11 text
JIFASNIF
JavaScript is fun and so node is fun!
#nodejs
IRC, Google Groups, GitHub, Twitter,
Meetups, Conferences...!
Slide 12
Slide 12 text
Node.js in the Wild
Companies that use node.js right now
Slide 13
Slide 13 text
Ready to Start your
Relationship?
Spin up a server in no time...
and get hacking!
Slide 14
Slide 14 text
Basics: A Really Simple
Web Server
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type':
'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.
0.0.1:1337/');
Slide 15
Slide 15 text
Basics: A Really Simple
Web Server
% node example.js
Server running at http://127.0.0.1:1337/
Slide 16
Slide 16 text
Basics: A Really Simple
Web Server
% npm install express
% express projectName
% cd projectName && npm install
% node app.js
Server running at http://localhost:3000
Slide 17
Slide 17 text
node.js:
The Less Good Parts
○ "Pyramid of Doom"
○ Core keeps changing
○ Too many options
○ Overkill for static sites
○ Scalability
○ Memory leaks (closures)
○ CoffeeScript, etc