SlideShare a Scribd company logo
3
Most read
5
Most read
6
Most read
Introduction to node.js
By
Dinesh
Agenda
What is node.js?
Why node.js?
How node.js works?
How node.js is different from others?
What can be done with node.js?
Few examples
Who is using node.js?
Why Node.js
Introduction to node.js
what is node.js?
“Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript
engine. Node.js uses an event-driven, Asynchronous non-blocking I/O
model that makes it lightweight and efficient.
What is v8 engine?
● It is a open source javascript engine. Developed by Chromium.
● It is written in c++
● V8 compiles JavaScript to native machine code, thereby compiling
and executing JavaScript code at a lightning speed
Difference between synchronous and asynchronous
● It waits for each
operation to complete,
after that it will
execute next operation.
● Step-By-Step Execution
● It will never waits for
each operation to
complete, rather it
executes all the
operations at a time.
The results of each
operation will be
handled once result is
available.
● CallBacks are used to
handle results
Synchronous example
Example:
var result = database.query("SELECT * FROM hugetable");
console.log(“db operation is done”);
console.log("Hello World");
Output:
db operation is done
Hello World
Asynchronous Example
Example:
database.query("SELECT * FROM hugetable", function(rows) {
var result = rows;
console.log(“After db operation”);
});
console.log("Hello World");
Output:
Hello world
After db operation
Asynchronous Example
Example:
database.query("SELECT * FROM hugetable", function(rows) {
var result = rows;
console.log(“After db operation”);
});
console.log("Hello World");
Output:
Hello world
After db operation
Introduction to node.js
Few more examples...
setTimeout(sayHello,1000);
Function sayHello(){
console.log(“Hello WiCheck Team”);
}
console.log(“VANAKKAM”);
Output:
VANAKKAM
Hello WiCheck Team
How to create callbacks?
function SayHello(str, callback){
//do what ever with str
// finally call callback
callback();
}
sayHello(“Alethea” , function(){
console.log(“I’M CallBack”);
});
Phantomjs
● Headless browser.
var page = require('webpage').create();
page.open('http://www.google.com', function(status) {
console.log("Status: " + status);
if(status === "success") {
page.render(‘google.png');
}
phantom.exit();
});
Introduction to node.js
There is a problem with callbacks....
getData(function(a){
getMoreData(a, function(b){
getMoreData(b, function(c){
getMoreData(c, function(d){
getMoreData(d, function(e){
...
});
});
});
});
});
How to avoid callbacks?
● Promises
● Generators
● Async/wait
● Third party libs(async.js)
Advantages of Node.js
● JavaScript In the backend and frontend
● Best for web servers(http)
● Node.js is a boon for building highly scalable Web App
● Node.js excels at Real-time
applications(Stock,chat,video)
● Data streaming gets easier.
Who uses Node.js
We
NetFlix
NYC
Paypal
Mongodb
LinkedIn
Uber
etc….
Thanks
Questions?

More Related Content

PDF
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
PPTX
Introduction to Node.js
PPT
Node.js Basics
PDF
Nodejs vatsal shah
PDF
NodeJS for Beginner
PDF
Nodejs presentation
PPTX
Basic Concept of Node.js & NPM
PPTX
Introduction Node.js
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Introduction to Node.js
Node.js Basics
Nodejs vatsal shah
NodeJS for Beginner
Nodejs presentation
Basic Concept of Node.js & NPM
Introduction Node.js

What's hot (20)

PPTX
Introduction to NodeJS
PPTX
Introduction to Node js
PPTX
Node js introduction
PPTX
Introduction to Node.js
PPTX
Node.js Express
PPTX
Node js for beginners
PDF
Introduction to Node.js
PPTX
NodeJS - Server Side JS
PPTX
Node js Introduction
PPTX
Introduction to angular with a simple but complete project
PPTX
Express js
PDF
Use Node.js to create a REST API
PPTX
PPTX
Express JS
PPTX
Build RESTful API Using Express JS
PDF
Express node js
PDF
React js
PDF
Introduction to ASP.NET Core
PDF
Introduzione ad angular 7/8
Introduction to NodeJS
Introduction to Node js
Node js introduction
Introduction to Node.js
Node.js Express
Node js for beginners
Introduction to Node.js
NodeJS - Server Side JS
Node js Introduction
Introduction to angular with a simple but complete project
Express js
Use Node.js to create a REST API
Express JS
Build RESTful API Using Express JS
Express node js
React js
Introduction to ASP.NET Core
Introduzione ad angular 7/8
Ad

Similar to Introduction to node.js (20)

PDF
Node, express & sails
PPTX
An overview of node.js
PDF
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
PPTX
PPTX
Node.js Test
PPTX
02 Node introduction
PDF
Best NODE-JS Online Training - Naresh IT
PPTX
Server Side Web Development Unit 1 of Nodejs.pptx
PPTX
What is node.js
PDF
Unlock the magic of NodeJS - 18/12/2024 - Slides
PPTX
concept of server-side JavaScript / JS Framework: NODEJS
PPTX
Difference between Node.js vs Java script
PPTX
Node_JS_Presentation.pptxgggghhhhhhhhhhhhh
PDF
Complete MVC on NodeJS
PDF
NodeJS_Presentation
PDF
Introduction to Node.js
PPTX
Quick introduction to nodeJs
PDF
Intro to node.js
Node, express & sails
An overview of node.js
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
Node.js Test
02 Node introduction
Best NODE-JS Online Training - Naresh IT
Server Side Web Development Unit 1 of Nodejs.pptx
What is node.js
Unlock the magic of NodeJS - 18/12/2024 - Slides
concept of server-side JavaScript / JS Framework: NODEJS
Difference between Node.js vs Java script
Node_JS_Presentation.pptxgggghhhhhhhhhhhhh
Complete MVC on NodeJS
NodeJS_Presentation
Introduction to Node.js
Quick introduction to nodeJs
Intro to node.js
Ad

Recently uploaded (20)

PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Understanding Forklifts - TECH EHS Solution
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Essential Infomation Tech presentation.pptx
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
DOCX
The Five Best AI Cover Tools in 2025.docx
DOCX
Looking for a Tableau Alternative Try Helical Insight Open Source BI Platform...
PPTX
FLIGHT TICKET RESERVATION SYSTEM | FLIGHT BOOKING ENGINE API
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Transform Your Business with a Software ERP System
PPTX
Mini project ppt template for panimalar Engineering college
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
Softaken Excel to vCard Converter Software.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Upgrade and Innovation Strategies for SAP ERP Customers
Understanding Forklifts - TECH EHS Solution
How to Migrate SBCGlobal Email to Yahoo Easily
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Essential Infomation Tech presentation.pptx
How Creative Agencies Leverage Project Management Software.pdf
top salesforce developer skills in 2025.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
The Five Best AI Cover Tools in 2025.docx
Looking for a Tableau Alternative Try Helical Insight Open Source BI Platform...
FLIGHT TICKET RESERVATION SYSTEM | FLIGHT BOOKING ENGINE API
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Transform Your Business with a Software ERP System
Mini project ppt template for panimalar Engineering college
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PTS Company Brochure 2025 (1).pdf.......
A REACT POMODORO TIMER WEB APPLICATION.pdf
Odoo POS Development Services by CandidRoot Solutions

Introduction to node.js

  • 2. Agenda What is node.js? Why node.js? How node.js works? How node.js is different from others? What can be done with node.js? Few examples Who is using node.js?
  • 5. what is node.js? “Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, Asynchronous non-blocking I/O model that makes it lightweight and efficient. What is v8 engine? ● It is a open source javascript engine. Developed by Chromium. ● It is written in c++ ● V8 compiles JavaScript to native machine code, thereby compiling and executing JavaScript code at a lightning speed
  • 6. Difference between synchronous and asynchronous ● It waits for each operation to complete, after that it will execute next operation. ● Step-By-Step Execution ● It will never waits for each operation to complete, rather it executes all the operations at a time. The results of each operation will be handled once result is available. ● CallBacks are used to handle results
  • 7. Synchronous example Example: var result = database.query("SELECT * FROM hugetable"); console.log(“db operation is done”); console.log("Hello World"); Output: db operation is done Hello World
  • 8. Asynchronous Example Example: database.query("SELECT * FROM hugetable", function(rows) { var result = rows; console.log(“After db operation”); }); console.log("Hello World"); Output: Hello world After db operation
  • 9. Asynchronous Example Example: database.query("SELECT * FROM hugetable", function(rows) { var result = rows; console.log(“After db operation”); }); console.log("Hello World"); Output: Hello world After db operation
  • 11. Few more examples... setTimeout(sayHello,1000); Function sayHello(){ console.log(“Hello WiCheck Team”); } console.log(“VANAKKAM”); Output: VANAKKAM Hello WiCheck Team
  • 12. How to create callbacks? function SayHello(str, callback){ //do what ever with str // finally call callback callback(); } sayHello(“Alethea” , function(){ console.log(“I’M CallBack”); });
  • 13. Phantomjs ● Headless browser. var page = require('webpage').create(); page.open('http://www.google.com', function(status) { console.log("Status: " + status); if(status === "success") { page.render(‘google.png'); } phantom.exit(); });
  • 15. There is a problem with callbacks.... getData(function(a){ getMoreData(a, function(b){ getMoreData(b, function(c){ getMoreData(c, function(d){ getMoreData(d, function(e){ ... }); }); }); }); });
  • 16. How to avoid callbacks? ● Promises ● Generators ● Async/wait ● Third party libs(async.js)
  • 17. Advantages of Node.js ● JavaScript In the backend and frontend ● Best for web servers(http) ● Node.js is a boon for building highly scalable Web App ● Node.js excels at Real-time applications(Stock,chat,video) ● Data streaming gets easier.