Introduction to Node js


Published on

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Introduction to Node js

  1. 1. Introduction to Node.JSPragnesh Vaghela | @technologythree |
  2. 2. Problemwhat’s a really common thing to do in a web application?Database access, of course. Too bad database I/O is one of theslowest things a web app has to deal with data = readFromDatabase(); printData(data); doSomethingUnrelated(); asynchronous JavaScript: readFromDatabase(function(data) { printData(data); }) doSomethingUnrelated(); @ 2013 Technology Three 2
  3. 3. NODE.JS1. platform built on Chromes JavaScript runtime for easily building fast, scalable network applications2. perfect for data-intensive real-time applications that run across distributed devices @ 2013 Technology Three 3
  4. 4. NODE.JS1. server-side JavaScript framework - the same type of code that powers awesome Ajax applications like Gmail will now power its servers, too2. driven by asynchronous design - that it doesn’t have to wait for slow file I/O or database operations to continue processing, which makes it really damn fast. It also means that it can handle millions of concurrent connections at once3. real-time applications - you do not have to bother with low-level sockets and protocols @ 2013 Technology Three 4
  5. 5. Bad Use Cases1. apps that are very heavy on CPU usage, and very light on actual I/O - video encoding software, artificial intelligence or similar CPU hungry software2. simple CRUD / HTML apps @ 2013 Technology Three 5
  6. 6. Good Use Cases• JSON APIs building light-weight REST / JSON apis is something where node.js really shines. Its non-blocking I/O model combined with JavaScript make it a great choice for wrapping other data sources such as databases or web services and exposing them via a JSON interface• Single page Apps if you are planning to write an AJAX heavy single page app (think gmail), node.js is a great fit as well. The ability to process many requests / seconds with low response times, as well as sharing things like validation code between the client and server make it a great choice for modern web applications that do lots of processing on the client @ 2013 Technology Three 6
  7. 7. Good Use Cases• Streaming data one great example is parsing file uploads in real time, as well as building proxies between different data layers• Soft Realtime Applications easy to develop soft real time systems like twitter, chat software, sport bets or interfaces to instant messaging networks @ 2013 Technology Three 7
  8. 8. Example Web Servervar http = require(http);http.createServer(function (request, response) { response.writeHead(200, {Content-Type: text/plain}); response.end(Hello Worldn);}).listen(8124);console.log(Server running at;To run the server, put the code into a file called example.js andexecute it with the node program:> node example.jsServer running at @ 2013 Technology Three 8
  9. 9. Real world Node.JS Applications @ 2013 Technology Three 9
  10. 10. NODE.JS in the industry1. CBS, Linkedin use Node.js for mobile2. Walmart’s Node-powered mobile app front-end code gets executed on the back end3. Yahoo has released some things for Node, and supports cocktails - a Node.js platform. It also uses Node.js in the livestand infrastructure4. Mozilla has implemented Node.js to support browser APIs which has half a billion installs5. Pinterest uses Node as a webserver in some instances6. Ebay hosts their HTTP API service with Node7. HP uses Node for their WebOS initiatives @ 2013 Technology Three 10
  11. 11. Thank YouPragnesh Vaghela | @technologythree |