Getting Started with

What we are going to cover

  1. What is Node.js

     

  2. What is Node.js good at

     

  3. How are people using Node.js

     

What is Node.js?

How we are used to doing I/O

            
result = db.executeQuery("SELECT name FROM Customers WHERE id=1");

// Wait for result

// Do something with result
            
        

The Traditional Model

How Node does I/O

            
db.executeQuery("SELECT name FROM Customers WHERE id=1", function(result, error){
        // Do something with the result
    });
            
        

The Node Model

What is Node.js Good At?

  1. IO Intensive tasks

     

  2. High Concurrency

     

  3. Low resource

     

  4. Reusing code across the client and server

     

The Node.js Ecosystem

Link to Visualization

What is Node.js Not Good At?

CPU Intensive tasks

 

          
var http = require('http');

var server = http.createServer(function(request, response) {
    console.log('Request received');

    // Long CPU operation
    for(var i=0; i<100000000; i+=1){
        console.log(i);
    }

    // After which response is sent
    response.write(200, {"Content-Type": "text/html"});
    response.write("hello");
    response.end();
});

server.listen(1256);
          
        

Demo

Who is using Node.js?

The thing it’s best at doing is talking to other services. The mobile app has to talk to our platform API and database. – LinkedIn’s mobile development lead Kiran Prasad

And many more

How we used Node

Whatsup

/