NodeJS Tour

2,201
-1

Published on

Introduction on NodeJS at Refresh Colombo

Published in: Education, Travel, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,201
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
31
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

NodeJS Tour

  1. 1. JavaScript on the Server Side<br />
  2. 2. I’m arunoda<br />
  3. 3. Introduction<br />Framework to built Servers<br />It’s about JavaScript<br />Created by Ryan Dhal in 2009<br />
  4. 4. Architecture<br />JavaScript<br />C++<br />NodeJS bindings (http, socket, IO etc..)<br />Event LoopLibEV<br />Thread PoolLibIO<br />JS EngineV8<br />
  5. 5. Programming model<br />Evented - No Threads<br />Non Blocking IO<br />Use of callbacks (closure)<br />db.insert({data:1000}, function(err) {<br />   //do something after inserted<br />})<br />console.log("I don't wait");<br />
  6. 6. Support<br />Commercial – <br />Community – Mainly over <br />Just 2 years old<br />~2500 modules<br />~800 authors<br />~300 new modules per month<br />~2000 new module updates per month<br />
  7. 7. Web and nodejs<br />Websites<br />Connect<br />Express<br />REST API<br />Express<br />Geddy<br />Communication<br />Socket IO<br />Now JS (RPC)<br />Dnode (RPC)<br />HTTP API - RESTler<br />
  8. 8. Express - sample<br />var app = express.createServer();<br /> <br />app.get('/info', function(req, res){<br />res.send('Hello World');<br />});<br /> <br />app.listen(3000);<br />
  9. 9. NOWJS - Sample<br />Server.js<br />var server= require("http").createServer();<br />varnowjs = require("now");<br />var remote= nowjs.initialize(httpServer);<br /> <br />remote.now.getServerInfo = function(callback){<br />getInfo(callback);<br />}<br />server.listen(8000);<br />Access.html<br /><script><br />now.getServerInfo(function(data){<br />//do something with the data<br />});<br /></script><br />
  10. 10. RESTler - Sample<br />var rest = require("restler");<br /> <br />rest.get("http://google.com").on("complete", function(data) {<br />console.log(data);<br />});<br />
  11. 11. Database support<br />
  12. 12. Package manager<br />It’s called NPM<br />Like ivy <br />But with JSON<br />npm install express<br />npm publish<br />
  13. 13. IDE <br />It’s BAD<br />No great debugger<br />Cloud9 IDE<br />Sublime Text 2<br />
  14. 14. HOSTING<br />
  15. 15. NODEJS Experience<br />Started 3 months back<br />Rewritten Yalu on NodeJS<br />Improved Performance<br />Projects on <br />
  16. 16. Usefull links<br />NodeJS Sri Lanka<br />bit.ly/nodelk<br />Node Links<br />bit.ly/node-info<br />
  17. 17. Thanks <br />Any Questions?<br />

×