• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
New kid on the block node.js
 

New kid on the block node.js

on

  • 923 views

This presentation was presented by at ‘Open source Conference’, Pune, India organised by SiliconIndia on 23rd March 2013.

This presentation was presented by at ‘Open source Conference’, Pune, India organised by SiliconIndia on 23rd March 2013.

Statistics

Views

Total Views
923
Views on SlideShare
888
Embed Views
35

Actions

Likes
0
Downloads
7
Comments
0

1 Embed 35

http://www.linkedin.com 35

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    New kid on the block node.js New kid on the block node.js Presentation Transcript

    • New Kid On The Block – Node.jsJoel DivekarGM – Information Systems,People Interactive (I) Pvt. Ltd.Open Source Conference, Pune23rd March, 2013
    • Node.js was developed by Ryan Dhal in 2009 and the project is managed by Joyent
    • Node.js is ...Server side JavaScript Event Driven Asynchronous I/O Single Threaded Lightweight
    • Node.js ...High performance network application framework and caneasily handle thousands of concurrent connections withminimum CPU / Memory UtilisationBuilt on top of Googles V8 JavaScript engine used inChromeEasy to build scalable network servers
    • Node.js is similar to ...EventMachine in RubyTwisted in Python
    • I/OBlocking I/Ovar fs = require(fs);var file1 = fs.readFileSync(File1.txt, utf­8);console.log(“Reading File1.txt”);var file2 = readFileSync(File2.txt, utf­8);console.log(“Reading File2.txt”);Non-Blocking I/Ovar fs = require(fs);fs.readFileSync(File1.txt, utf­8, function(err,data){    console.log(“Reading File1.txt”)});fs.readFileSync(File2.txt, utf­8, function(err,data){    console.log(“Reading File2.txt”)});
    • I/OBlocking I/OReading File1.txt took 10 msReading File2.txt took 6 msTotal time 16 msNon-Blocking I/OReading File1.txt took 10 msReading File2.txt took 6 msTotal time 10 ms
    • Callback//callback after 2 secondssetTimeout(function(){    console.log(“World”);}, 2000);    console.log(“Hello”);
    • Node REPLREPL : Read - Eval - Print - Loop$ node> a=[1,2,"3",four,];[ 1, 2, 3, four ]> a.forEach(function (v) {... console.log(v);... });123fourUndefined> .exit
    • Node.js HTTP Servervar http = require("http");http.createServer(function(req, res) {req.on("end", function () {res.writeHead(200, {Content­Type : text/plain});res.end(Your IP is  + (req.headers[x­forwarded­for] ||  req.connection.remoteAddress) + !) });}).listen(8080);console.log("Server accepting request on http://127.0.0.1:8080");
    • Node.js HTTP Servervar http = require("http");http.createServer(function(req, res) {req.on("end", function () {res.writeHead(200, {Content­Type : text/plain});res.end(Your IP is  + (req.headers[x­forwarded­for] ||  req.connection.remoteAddress) + !) });}).listen(8080);console.log("Server accepting request on http://127.0.0.1:8080");
    • npmnpm is package manager for node.js, similar to RubyGems & Python easy_installnpm install <module_name>ModulesExpress – MVC frameworkSocket.IO – Websocket Library
    • Who is using Node.js ...
    • Thanks a lot for your time … joel.divekar@gmail.com www.linkedin.com/in/joeldivekar joeldivekar.blogspot.com www.slideshare.net/JoelDivekar