Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Nodejs Intro


Published on

This presentation was intended to be used at Frankfurt HTML5/CSS3 meetup in April. It wasn't but I still felt like uploading it ;)

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Nodejs Intro

  1. 1. Node.js “Because nothing blocks, less-than-expert programmers are able to develop fast systems.” Rocco Georgi, PavingWays Ltd.
  2. 2. Node.js written in C and JavaScript I/O framework evented non-blocking server-side JavaScript CommonJS module system using V804/2010 Rocco Georgi, PavingWays Ltd.
  3. 3. written in C ./configure make make install #> node myfile.js04/2010 Rocco Georgi, PavingWays Ltd.
  4. 4. I/O network I/O file I/O * I/O04/2010 Rocco Georgi, PavingWays Ltd.
  5. 5. evented var tcp = require(tcp); var server = tcp.createServer(function (socket) { socket.setEncoding("utf8"); event handlers socket.addListener("connect", function () { socket.send("hellorn"); for anything }); socket.addListener("receive", function (data) { event loop }); socket.send(data); no threads socket.addListener("eof", function () { socket.send("goodbyern"); socket.close(); }); }); server.listen(7000, "localhost");04/2010 Rocco Georgi, PavingWays Ltd.
  6. 6. non-blocking I/O is never blocking anything callbacks on anything everything in a single thread + loop very small memory footprint04/2010 Rocco Georgi, PavingWays Ltd.
  7. 7. server-side JS V8 engine CommonJS: file = module // this loads circle.js and the sys object var circle = require(./circle); var sys = require(sys); // use the sys and circle object sys.puts(circle area at radius 4 = + circle.area(4)); no window object04/2010 Rocco Georgi, PavingWays Ltd.
  8. 8. Benefits low memory footprint per connection high concurrency “hanging” requests -> Comet custom TCP/HTTP servers active module community e.g. WebSockets server04/2010 Rocco Georgi, PavingWays Ltd.