!SLIDE center
#Dive Into
##Matt Swanson ##August 23, 2011
!SLIDE bullets #Node is…
!SLIDE bullets #Scalabe network programs
!SLIDE center
##Quick Refresher
###http://krondo.com/wp-content/uploads/2009/08/twisted-intro.html
!SLIDE center
#So where’s the speedup?
##Frequent waiting in web apps
!SLIDE bullets #Server-side JavaScript
!SLIDE small @@@ javascript //hello-world.js var http = require(‘http’);
var server = http.createServer(function (req, res) {
res.writeHead(200, {"Content-Type": "text/plain"});
res.end("Hello Node\n");
});
server.listen(8000);
>> node hello-world.js
!SLIDE #Getting your bearings
So you want to... | |
Install node | http://nodejs.org |
- Windows | Pre-built binary for v0.5.4 (unstable) |
- OS X | >> brew install node |
Package manager | http://npmjs.org |
- Install packages | >> npm install mongoose |
REPL | >> node |
Run a script | >> node foo.js |
Debug GDB-style | >> node debug foo.js Add debugger statements in code |
Debug GUI | Install node-inspector |
Cloud deployment | heroku, no.de, nodester |
!SLIDE #Demo ##Streaming RSS with WebSockets
!SLIDE bullets #Good Use Cases
###http://nodeguide.com/convincing_the_boss.html
!SLIDE bullets #Not-so-good Use Cases
###http://nodeguide.com/convincing_the_boss.html
!SLIDE bullets #Tips
package.json
to freeze dependencies!SLIDE full-screen