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

Getting started with developing Nodejs