3. What’s your avor? Java
Python
C / C++ / C#
Erlang / Haskell
Ruby JavaScript
4. JavaScript, really?
• Learning Javascript used to mean you weren't a
"serious software developer". Today, not learning
Javascript means the same thing.
- James Governor ( @monkchips )
• http://twitter.com/monkchips/status/25217409319
5. The Hype Hacker News <3’s Node.js
“Everyone’s talking about it.”
6. GitHub Node is the #3 most watched project
on GitHub ...and moving fast.
11. My Favorite Reason
• JavaScript on the Client
• JavaScript on the Server
= Fun!
12. Show Me Some Code!
var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200,
{'Content-Type': 'text/plain'});
res.write('Hello, Node.n');
res.end();
}).listen(1337);
console.log('Server running on :1337');
14. var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200,
{'Content-Type': 'text/plain'});
res.write('Hello, Node.n');
res.end();
}).listen(1337);
console.log('Server running on :1337');
Essential Node.js You probably won’t spend too much time
writing request/response code.
15. var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200,
{'Content-Type': 'text/plain'});
res.write('Hello, Node.n');
res.end();
}).listen(1337);
console.log('Server running on :1337');
Essential Node.js Don’t cheat yourself.
You need to spend some time though.
16. Require
var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200,
{'Content-Type': 'text/plain'});
res.write('Hello, Node.n');
res.end();
}).listen(1337);
console.log('Server running on :1337');
Node’s Anatomy CommonJS Require
Server definition
Talk to yourself
17. Require
var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200,
{'Content-Type': 'text/plain'});
res.write('Hello, Node.n');
res.end();
}).listen(1337); Server
console.log('Server running on :1337');
Node’s Anatomy CommonJS Require
Server definition
Talk to yourself
18. Require
var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200,
{'Content-Type': 'text/plain'});
res.write('Hello, Node.n');
res.end();
}).listen(1337); Server
console.log('Server running on :1337');
This is for you.
Node’s Anatomy CommonJS Require
Server definition
Talk to yourself
19. Getting Started
• nodejs.org
• API: nodejs.org/api.html
• github.com/ry/node
• github.com/ry/node/wiki
• Google Group [1]
[1] http://groups.google.com/group/nodejs • IRC #node.js on Freenode.
20. Install from source:
$ git clone http://github.com/ry/node.git
$ cd node
$ ./configure
$ make
$ make install
Installing Node.js It’s really easy.
(If you’re on a Mac or Linux.)
Windows... not so much.
27. Connect
• Connect provides a robust set of
middleware for building apps:
logging, static files, JSON-RPC.
• Need sessions, use Connect.
• github.com/senchalabs/connect
• npm install connect
28. Web Sockets
• Pure Web Sockets.
• Very efficient. Great API.
• Both draft75 and draft76 protocols.
• github.com/miksago/node-websocket-
server
• npm install websocket-server
29. Socket.IO
• Abstracts and extends the Web Socket
metaphor.
• Everything looks like a Web Socket.
• Supports: Flash, XHR Long Polling,
XHR Multipart Streaming (Comet)
• socket.io (yes, that’s a url.)
• npm install socket.io