SlideShare a Scribd company logo
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Webpage
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Agenda
❖ Client Server Architecture
❖ Limitations of Multi–Threaded Model
❖ What is Node.js?
❖ Features of Node.js
❖ Node.js Installation
❖ Blocking Vs. Non – Blocking I/O
❖ Creating Node.js First Program
❖ Node.js Modules
❖ Demo – Grocery List Web Application using Node.js
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Client – Server Architecture
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Client Server Architecture
Client 1
Client 2
Client 3
Server Database
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Traditional Multi-Threaded Model
Handle Request
A
Handle Request
B
Handle Request
C
Read ResponseRead Request
Assign Thread for A
Assign Thread for C
Assign Thread for B
Thread
Thread
Thread
User HTTP Request A
User HTTP Request B
User HTTP Request C
User HTTP Request D
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Limitations
of
Multi – Threaded Approach
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Limitations of Multi-Threaded Models
Shared
Resources
Updating
Resources
Wants to
Update
Wants to
Update
Thread A Thread C
Thread B
➢ In a multi-threaded HTTP server, for each and every request that the server receives, it creates a separate thread
which handles that request
➢ If a request acquires a lock in the shared resource and it is ‘exclusive’, it will affect result of other requests
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
High chances of deadlock if application
is not designed properly
Limitations of Multi-Threaded Models
Web Servers need to handle thousands
of HTTP requests. So, many threads may
have to wait for network operations
For thousands of simultaneous requests,
spawning threads for all processes would
not achieve the desired scalability
Scalability
Complex
Deadlock
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
What is Node.js ?
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
What is Node.js?
➢Node.js is an open source runtime environment for server-side and networking applications and is single threaded.
➢Uses Google JavaScript V8 Engine to execute code.
➢It is cross platform environment and can run on OS X, Microsoft Windows, Linux, FreeBSD, NonStop and IBM.
➢Provides an event driven architecture and non blocking I/O that is optimized and scalable.
N O D E
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Features of Node.js
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Features of Node.js
1. Asynchronous
Caller Recipient
request
response
callback
➢ When request is made to server, instead of waiting for the request to complete, server continues to
process other requests
➢ When request processing completes, the response is sent to caller using callback mechanism
Asynchronous Model
Asynchronous
Event Driven
Very Fast
Scalable
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Features of Node.js
➢ When request is made to server, instead of waiting for the request to complete, server continues to
process other requests
➢ When request processing completes, the response is sent to caller using callback mechanism
Event Emitters
Event Loop
(Single - threaded)
File System
Network
Process
Other
Event Queue
Thread Pool
2. Single Threaded and Event Driven:
Asynchronous
Event Driven
Very Fast
Scalable
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Features of Node.js
3. Very Fast
4. Single Threaded but Highly Scalable
Being built on Google Chrome's V8 JavaScript Engine, Node.js library is very fast in code
execution.
Node.js is highly scalable because event mechanism helps the server to respond in a non-
blocking way.
Asynchronous
Event Driven
Very Fast
Scalable
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Node.js Installation
EDUREKA NODE JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Node.js Installation
Go to https://nodejs.org/en/1
Download and Install2
EDUREKA NODE JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Node.js Installation
Open node.js command prompt3
➢ node –version
Check the version of Node.js
installed
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Creating Your First Node.js Program
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Node.js First Program
Create a Directory: mkdir node_example1
Create a File: first_example.js2
Go to the node_example directory3
Execute the java script file: node first_example.js4
2
1
3
4
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Simple Web Application Example
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Simple Web Application Example
Example:
Importing Module:
‘require’ is used to load a Node.js modules.
1
Example:
Creating Server
➢ Used to create web server object
➢ Function (request, response) is called once for
every HTTP request to the server, so it's called
the request handler.
2
listen(<port_no>)
Bind the server instance for listening to a particular port.3
Example:
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Simple Web Application Example
1 Import HTTP Module
2 Define Port No.
3 Creating Server Instance
4 Sending HTTP Header
6
Binding Server Instance
with the Port No. 3000
5 Sending Data
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Simple Web Application Example
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Blocking vs Non - Blocking
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Blocking vs Non–Blocking I/O
➢ Blocking is when the execution of additional JavaScript in the Node.js process must wait until a non-JavaScript
operation completes.
➢ "I/O" refers primarily to interaction with the system's disk and network supported by libuv.
More methods will be blocked till
the read method is not executed
More method will execute
asynchronously
(non-blocking way)
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Blocking vs Non–Blocking I/O
Non – Blocking Example:
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Blocking vs Non–Blocking I/O
Blocking Example:
C O N C L U S I O N :
➢ In case of Asynchronous (non-blocking ), once file I/O is complete, it will call the callback function
➢ This allows Node.js to be scalable and process large number of request without worrying about blocking I/O
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Node.js Modules
02
GLOBALS
03
FILE SYSTEM
04
CALLBACKS
05
EVENT
06
HTTP
01
NPM
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
NPM
➢ NPM stands for Node Package Manager
➢ Provides online repositories for node.js packages/modules
➢ Provides command line utility to install Node.js packages along with version management and dependency
management.
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
NPM
npm install Install all the modules as specified in package.json
npm install <Module Name> Install Module using npm
npm install <Module Name> -g Install dependency globally
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Basic Concepts:
02
GLOBALS
03
FILE SYSTEM
04
CALLBACKS
05
EVENT
06
HTTP
01
NPM
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Global Objects
These objects are available in all modules and therefore, are referred as Global Objects
specifies the name of the directory that currently contains the code.
__dirname
specifies the name of the file that currently contains the code.
__filename
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Global Objects
A timer in Node.js is an internal construct that calls a given function after a certain period of time.
setTimeout(callback, delay[, ...args])
➢ Schedules execution of a one-time callback after delay milliseconds
➢ Returns a Timeout for use with clearTimeout( )
setInterval(callback, delay[, ...args])
➢ Schedules repeated execution of callback every delay milliseconds.
➢ Returns a Timeout for use with clearTimeout( )
setImmediate(callback, [,..args])
➢ Schedules an immediate execution of the callback after I/O events' callbacks but
before setTimeout() and setInterval() timers are triggered.
➢ Returns an Immediate for use with clearImmediate().
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Global Objects
output
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Node.js Modules
02
GLOBALS
03
FILE SYSTEM
04
CALLBACKS
05
EVENT
06
HTTP
01
NPM
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
File System
File I/O is provided by simple wrappers around standard POSIX functions. For importing File
System Module (fs), we use: var fs = require("fs");
All methods have asynchronous and synchronous formsImportant Note:
FS Methods
Asynchronous
Forms
Synchronous
Forms
1
var fs = require("fs");
// Asynchronous read
fs.readFile(‘test.txt', function (err, data) { });
// Synchronous read
var data = fs.readFileSync('input.txt');
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
File System
The asynchronous form always takes a completion callback as its last argument.
var fs = require("fs");
// Asynchronous read
fs.readFile(‘test.txt’, function (err, data) {
if (err) {
return console.error(err);
}
console.log(data.toString());
});
FS Methods
Arg 1
Callback Method
(last argument)
Arg 2
Arg 3
Callback As Last Arg.
Important Note: 2
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
File System
First argument in completion callback is always reserved for an exceptionImportant Note: 3
Callback
Method
Arg 1: exception
Arg N
Arg 2
Arg 3
var fs = require("fs");
// Asynchronous read
fs.readFile(‘test.txt’, function (err, data) {
if (err) {
return console.error(err);
}
console.log(data.toString());
});
Reserved for
exception
returns null or undefined
(successful completion)
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Some Methods in File System Module – Open()
fs.open( path, flags[, mode], callback )
fs.openSync( path, flags[, mode] )
fs.close( fd, callback )
➢ var fs = require(‘fs’);
Open File Asynchronously
Open File Synchronously
Closing File
Arguments Description
Path < string > Path of the file
Flags < string > Access Modifiers
Mode < integer > sets the permission and sticky bits, but only if the file was created
Callback < function > Callback signature - function(err, fd)
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Flag Modes in Open Method
Modes Description
r Open file for reading. an exception occurs if the file does not exist
r+ Open file for reading and writing. Exception: if the file does not exist
w Open file for writing. The file is created ( if it does not exist) or truncated (if it exists)
wx Like 'w' but fails if path exists
w+ Open file for reading and writing. File is created (if it does not exist) or truncated (if it exists)
wx+ Same as 'w+' but fails if path exists
a Open file for appending. The file is created if it does not exist
ax Like 'a' but fails if path exists
a+ open file for reading and appending. the file is created if it does not exist.
ax+ Like 'a+' but fails if path exists
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Some Methods in File System Module – Read()
read(fd, buffer, offset, length, position, callback)
readFile(file[, options], callback)
readFileSync(file[, options])
Read Content of a File into Buffer
Reads File Asynchronously
Arguments Description
fd < integer > File Descriptor
buffer <string | Buffer | Unit8Array > The buffer that the data will be written to.
offset < integer > Offset in the buffer to start writing at.
length < integer > Specifies the number of bytes to read.
position < integer > Specifies where to begin reading from in the file
Callback < function > Read Callback signature - function(err, bytesRead, buffer)
Reads File Synchronously
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Some Methods in File System Module – Write()
writeFile(file, data[, options], callback)
writeFileSync(file, data[, options])
Writes into a File Asynchronously
Arguments Description
File Filename or File Descriptor
Data The buffer that the data will be written to.
Options: Encoding, Mode or flag
Callback < function > Callback signature - function(err, bytesRead, buffer)
Writes into a File Synchronously
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Node.js Modules
02
GLOBALS
03
FILE SYSTEM
04
CALLBACKS
05
EVENT
06
HTTP
01
NPM
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Some Methods in File System Module – Write()
Callback is an asynchronous equivalent for a function and is called at the completion of each task
Callback: will execute after
file read is complete
Output:
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Node.js Modules
02
GLOBALS
03
FILE SYSTEM
04
CALLBACKS
05
EVENT
06
HTTP
01
NPM
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Events
➢ Node.js follows event-driven architecture where certain objects (called "emitters") periodically emit
named events which further invokes the listeners (function).
➢ Node.js provide concurrency by using the concept of events and callbacks
➢ All objects that emit events are instances of the EventEmitter class.
var eventEmitter = event.EventEmitter();
Importing ‘events’ module
Object of EventEmitter Class
eventEmitter.emit(‘event’)
Registering listeners
Trigger event
eventEmitter.on(‘event’, eventHandler)
var event = require(‘events’);
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Events
Import Events Module
Creating object of EventEmitter
Emitting event
Registering Listener and defining
event handler
OUTPUT
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Node.js Modules
02
GLOBALS
03
FILE SYSTEM
04
CALLBACKS
05
EVENT
06
HTTP
01
NPM
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Web Application Architecture
Client Client Client Client
Mobile
Browser
Web
Browser
Application
Web Server
Application
Server
File System
Database
External
File System
Client Server Business Layer Data Layer
Makes HTTP Request
to the server
Serve the request
Made by client and
pass the response
contains application
utilized by web server to
do required processing.
Consists of Database
and other data storage
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
HTTP
Import Required Modules
Creating Server
Parse the fetched URL to get pathname
Request file to be read from file system
(index.html)
Creating Header with content type as text or HTML
Generating Response
Listening to port: 3000
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
HTTP
Index.html
Output
Node.js cmd
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Express
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Express Framework
➢ Express is a minimal and flexible Node.js web application framework that provides a robust set of features for
web and mobile applications.
➢ Inspired by Sinatra (web framework based on Ruby) and also, intertwined with Connect, a “plugin” library for
Node.
➢ Express used to come bundled with Connect before version 4.0
➢ After version 4.0, Connect (and all middleware except static) was removed to allow these middleware to be
updated independently
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Express Framework
Importing express module
Retrieve resources
Sending html doc as response
Listening to port: 3000
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
RESTful API
REST stands for REpresentational State Transfer.
Used create a new resource
or update a existing
resource
1 POST
Used to provide a read
only access to a resource
2 GET
Used to create a update
a resource
3 PUT
Used to remove a resource
4 DELETE
C R U DCreate Delete
Read Update
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Popular Frameworks Around
Node.js
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Popular Frameworks Around Node.js
E X P R E S S
Minimalistic Web
Framework based on
Node.js
S A I L S
Project generator,
Middleware and
Templating Engine
M E T E O R
Full Stack Framework
that covers server,
mobile, desktop & web
apps
K O A
Web Framework
designed by the team
behind Express
N O D E
www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING
Demo:
Grocery List Web Application
EDUREKA NODE JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Thank You …
Questions/Queries/Feedback

More Related Content

What's hot (20)

Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
Arvind Devaraj
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
Ganesh Kondal
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
AMD Developer Central
 
Node js
Node jsNode js
Node js
Fatih Şimşek
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Rob O'Doherty
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
Joseph de Castelnau
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPM
Bhargav Anadkat
 
Express js
Express jsExpress js
Express js
Manav Prasad
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
07.pallav
 
Angular
AngularAngular
Angular
Lilia Sfaxi
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
Apaichon Punopas
 
Nodejs functions & modules
Nodejs functions & modulesNodejs functions & modules
Nodejs functions & modules
monikadeshmane
 
Workshop 21: React Router
Workshop 21: React RouterWorkshop 21: React Router
Workshop 21: React Router
Visual Engineering
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
Christoffer Noring
 
TypeScript - An Introduction
TypeScript - An IntroductionTypeScript - An Introduction
TypeScript - An Introduction
NexThoughts Technologies
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
DivyanshGupta922023
 
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
Edureka!
 
jQuery
jQueryjQuery
jQuery
Jay Poojara
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
Rasheed Waraich
 
Web api
Web apiWeb api
Web api
Sudhakar Sharma
 

Similar to Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js Training | Edureka (20)

Top 50 Node.js Interview Questions and Answers | Edureka
Top 50 Node.js Interview Questions and Answers | EdurekaTop 50 Node.js Interview Questions and Answers | Edureka
Top 50 Node.js Interview Questions and Answers | Edureka
Edureka!
 
Communication in Node.js
Communication in Node.jsCommunication in Node.js
Communication in Node.js
Edureka!
 
Day In A Life Of A Node.js Developer
Day In A Life Of A Node.js DeveloperDay In A Life Of A Node.js Developer
Day In A Life Of A Node.js Developer
Edureka!
 
Day in a life of a node.js developer
Day in a life of a node.js developerDay in a life of a node.js developer
Day in a life of a node.js developer
Edureka!
 
NodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin WayNodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin Way
Edureka!
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Jack Franklin
 
Playing With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.jsPlaying With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.js
Mike Hagedorn
 
Jaap : node, npm & grunt
Jaap : node, npm & gruntJaap : node, npm & grunt
Jaap : node, npm & grunt
Bertrand Chevrier
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
Rami Sayar
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.jsBasic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.js
Gary Yeh
 
Create Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express FrameworkCreate Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express Framework
Edureka!
 
Node.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first stepsNode.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first steps
Manuel Eusebio de Paz Carmona
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
Ahmed Assaf
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDD
Sudar Muthu
 
Node.js Introduction
Node.js IntroductionNode.js Introduction
Node.js Introduction
Kelum Senanayake
 
What is Node.js
What is Node.jsWhat is Node.js
What is Node.js
mohamed hadrich
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami Sayar
FITC
 
Node in Real Time - The Beginning
Node in Real Time - The BeginningNode in Real Time - The Beginning
Node in Real Time - The Beginning
Axilis
 
Node.js for beginner
Node.js for beginnerNode.js for beginner
Node.js for beginner
Sarunyhot Suwannachoti
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
Top 50 Node.js Interview Questions and Answers | Edureka
Top 50 Node.js Interview Questions and Answers | EdurekaTop 50 Node.js Interview Questions and Answers | Edureka
Top 50 Node.js Interview Questions and Answers | Edureka
Edureka!
 
Communication in Node.js
Communication in Node.jsCommunication in Node.js
Communication in Node.js
Edureka!
 
Day In A Life Of A Node.js Developer
Day In A Life Of A Node.js DeveloperDay In A Life Of A Node.js Developer
Day In A Life Of A Node.js Developer
Edureka!
 
Day in a life of a node.js developer
Day in a life of a node.js developerDay in a life of a node.js developer
Day in a life of a node.js developer
Edureka!
 
NodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin WayNodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin Way
Edureka!
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Jack Franklin
 
Playing With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.jsPlaying With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.js
Mike Hagedorn
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
Rami Sayar
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.jsBasic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.js
Gary Yeh
 
Create Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express FrameworkCreate Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express Framework
Edureka!
 
Node.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first stepsNode.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first steps
Manuel Eusebio de Paz Carmona
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
Ahmed Assaf
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDD
Sudar Muthu
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami Sayar
FITC
 
Node in Real Time - The Beginning
Node in Real Time - The BeginningNode in Real Time - The Beginning
Node in Real Time - The Beginning
Axilis
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
Ad

More from Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
Edureka!
 
What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
Edureka!
 
Ad

Recently uploaded (20)

vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUEIntroduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 

Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js Training | Edureka

  • 1. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Webpage
  • 2. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Agenda ❖ Client Server Architecture ❖ Limitations of Multi–Threaded Model ❖ What is Node.js? ❖ Features of Node.js ❖ Node.js Installation ❖ Blocking Vs. Non – Blocking I/O ❖ Creating Node.js First Program ❖ Node.js Modules ❖ Demo – Grocery List Web Application using Node.js
  • 3. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Client – Server Architecture
  • 4. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Client Server Architecture Client 1 Client 2 Client 3 Server Database
  • 5. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Traditional Multi-Threaded Model Handle Request A Handle Request B Handle Request C Read ResponseRead Request Assign Thread for A Assign Thread for C Assign Thread for B Thread Thread Thread User HTTP Request A User HTTP Request B User HTTP Request C User HTTP Request D
  • 6. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Limitations of Multi – Threaded Approach
  • 7. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Limitations of Multi-Threaded Models Shared Resources Updating Resources Wants to Update Wants to Update Thread A Thread C Thread B ➢ In a multi-threaded HTTP server, for each and every request that the server receives, it creates a separate thread which handles that request ➢ If a request acquires a lock in the shared resource and it is ‘exclusive’, it will affect result of other requests
  • 8. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING High chances of deadlock if application is not designed properly Limitations of Multi-Threaded Models Web Servers need to handle thousands of HTTP requests. So, many threads may have to wait for network operations For thousands of simultaneous requests, spawning threads for all processes would not achieve the desired scalability Scalability Complex Deadlock
  • 9. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING What is Node.js ?
  • 10. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING What is Node.js? ➢Node.js is an open source runtime environment for server-side and networking applications and is single threaded. ➢Uses Google JavaScript V8 Engine to execute code. ➢It is cross platform environment and can run on OS X, Microsoft Windows, Linux, FreeBSD, NonStop and IBM. ➢Provides an event driven architecture and non blocking I/O that is optimized and scalable. N O D E
  • 11. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Features of Node.js
  • 12. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Features of Node.js 1. Asynchronous Caller Recipient request response callback ➢ When request is made to server, instead of waiting for the request to complete, server continues to process other requests ➢ When request processing completes, the response is sent to caller using callback mechanism Asynchronous Model Asynchronous Event Driven Very Fast Scalable
  • 13. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Features of Node.js ➢ When request is made to server, instead of waiting for the request to complete, server continues to process other requests ➢ When request processing completes, the response is sent to caller using callback mechanism Event Emitters Event Loop (Single - threaded) File System Network Process Other Event Queue Thread Pool 2. Single Threaded and Event Driven: Asynchronous Event Driven Very Fast Scalable
  • 14. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Features of Node.js 3. Very Fast 4. Single Threaded but Highly Scalable Being built on Google Chrome's V8 JavaScript Engine, Node.js library is very fast in code execution. Node.js is highly scalable because event mechanism helps the server to respond in a non- blocking way. Asynchronous Event Driven Very Fast Scalable
  • 15. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Node.js Installation
  • 16. EDUREKA NODE JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Node.js Installation Go to https://nodejs.org/en/1 Download and Install2
  • 17. EDUREKA NODE JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Node.js Installation Open node.js command prompt3 ➢ node –version Check the version of Node.js installed
  • 18. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Creating Your First Node.js Program
  • 19. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Node.js First Program Create a Directory: mkdir node_example1 Create a File: first_example.js2 Go to the node_example directory3 Execute the java script file: node first_example.js4 2 1 3 4
  • 20. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Simple Web Application Example
  • 21. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Simple Web Application Example Example: Importing Module: ‘require’ is used to load a Node.js modules. 1 Example: Creating Server ➢ Used to create web server object ➢ Function (request, response) is called once for every HTTP request to the server, so it's called the request handler. 2 listen(<port_no>) Bind the server instance for listening to a particular port.3 Example:
  • 22. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Simple Web Application Example 1 Import HTTP Module 2 Define Port No. 3 Creating Server Instance 4 Sending HTTP Header 6 Binding Server Instance with the Port No. 3000 5 Sending Data
  • 23. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Simple Web Application Example
  • 24. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Blocking vs Non - Blocking
  • 25. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Blocking vs Non–Blocking I/O ➢ Blocking is when the execution of additional JavaScript in the Node.js process must wait until a non-JavaScript operation completes. ➢ "I/O" refers primarily to interaction with the system's disk and network supported by libuv. More methods will be blocked till the read method is not executed More method will execute asynchronously (non-blocking way)
  • 26. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Blocking vs Non–Blocking I/O Non – Blocking Example:
  • 27. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Blocking vs Non–Blocking I/O Blocking Example: C O N C L U S I O N : ➢ In case of Asynchronous (non-blocking ), once file I/O is complete, it will call the callback function ➢ This allows Node.js to be scalable and process large number of request without worrying about blocking I/O
  • 28. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Node.js Modules 02 GLOBALS 03 FILE SYSTEM 04 CALLBACKS 05 EVENT 06 HTTP 01 NPM
  • 29. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING NPM ➢ NPM stands for Node Package Manager ➢ Provides online repositories for node.js packages/modules ➢ Provides command line utility to install Node.js packages along with version management and dependency management.
  • 30. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING NPM npm install Install all the modules as specified in package.json npm install <Module Name> Install Module using npm npm install <Module Name> -g Install dependency globally
  • 31. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Basic Concepts: 02 GLOBALS 03 FILE SYSTEM 04 CALLBACKS 05 EVENT 06 HTTP 01 NPM
  • 32. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Global Objects These objects are available in all modules and therefore, are referred as Global Objects specifies the name of the directory that currently contains the code. __dirname specifies the name of the file that currently contains the code. __filename
  • 33. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Global Objects A timer in Node.js is an internal construct that calls a given function after a certain period of time. setTimeout(callback, delay[, ...args]) ➢ Schedules execution of a one-time callback after delay milliseconds ➢ Returns a Timeout for use with clearTimeout( ) setInterval(callback, delay[, ...args]) ➢ Schedules repeated execution of callback every delay milliseconds. ➢ Returns a Timeout for use with clearTimeout( ) setImmediate(callback, [,..args]) ➢ Schedules an immediate execution of the callback after I/O events' callbacks but before setTimeout() and setInterval() timers are triggered. ➢ Returns an Immediate for use with clearImmediate().
  • 34. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Global Objects output
  • 35. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Node.js Modules 02 GLOBALS 03 FILE SYSTEM 04 CALLBACKS 05 EVENT 06 HTTP 01 NPM
  • 36. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING File System File I/O is provided by simple wrappers around standard POSIX functions. For importing File System Module (fs), we use: var fs = require("fs"); All methods have asynchronous and synchronous formsImportant Note: FS Methods Asynchronous Forms Synchronous Forms 1 var fs = require("fs"); // Asynchronous read fs.readFile(‘test.txt', function (err, data) { }); // Synchronous read var data = fs.readFileSync('input.txt');
  • 37. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING File System The asynchronous form always takes a completion callback as its last argument. var fs = require("fs"); // Asynchronous read fs.readFile(‘test.txt’, function (err, data) { if (err) { return console.error(err); } console.log(data.toString()); }); FS Methods Arg 1 Callback Method (last argument) Arg 2 Arg 3 Callback As Last Arg. Important Note: 2
  • 38. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING File System First argument in completion callback is always reserved for an exceptionImportant Note: 3 Callback Method Arg 1: exception Arg N Arg 2 Arg 3 var fs = require("fs"); // Asynchronous read fs.readFile(‘test.txt’, function (err, data) { if (err) { return console.error(err); } console.log(data.toString()); }); Reserved for exception returns null or undefined (successful completion)
  • 39. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Some Methods in File System Module – Open() fs.open( path, flags[, mode], callback ) fs.openSync( path, flags[, mode] ) fs.close( fd, callback ) ➢ var fs = require(‘fs’); Open File Asynchronously Open File Synchronously Closing File Arguments Description Path < string > Path of the file Flags < string > Access Modifiers Mode < integer > sets the permission and sticky bits, but only if the file was created Callback < function > Callback signature - function(err, fd)
  • 40. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Flag Modes in Open Method Modes Description r Open file for reading. an exception occurs if the file does not exist r+ Open file for reading and writing. Exception: if the file does not exist w Open file for writing. The file is created ( if it does not exist) or truncated (if it exists) wx Like 'w' but fails if path exists w+ Open file for reading and writing. File is created (if it does not exist) or truncated (if it exists) wx+ Same as 'w+' but fails if path exists a Open file for appending. The file is created if it does not exist ax Like 'a' but fails if path exists a+ open file for reading and appending. the file is created if it does not exist. ax+ Like 'a+' but fails if path exists
  • 41. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Some Methods in File System Module – Read() read(fd, buffer, offset, length, position, callback) readFile(file[, options], callback) readFileSync(file[, options]) Read Content of a File into Buffer Reads File Asynchronously Arguments Description fd < integer > File Descriptor buffer <string | Buffer | Unit8Array > The buffer that the data will be written to. offset < integer > Offset in the buffer to start writing at. length < integer > Specifies the number of bytes to read. position < integer > Specifies where to begin reading from in the file Callback < function > Read Callback signature - function(err, bytesRead, buffer) Reads File Synchronously
  • 42. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Some Methods in File System Module – Write() writeFile(file, data[, options], callback) writeFileSync(file, data[, options]) Writes into a File Asynchronously Arguments Description File Filename or File Descriptor Data The buffer that the data will be written to. Options: Encoding, Mode or flag Callback < function > Callback signature - function(err, bytesRead, buffer) Writes into a File Synchronously
  • 43. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Node.js Modules 02 GLOBALS 03 FILE SYSTEM 04 CALLBACKS 05 EVENT 06 HTTP 01 NPM
  • 44. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Some Methods in File System Module – Write() Callback is an asynchronous equivalent for a function and is called at the completion of each task Callback: will execute after file read is complete Output:
  • 45. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Node.js Modules 02 GLOBALS 03 FILE SYSTEM 04 CALLBACKS 05 EVENT 06 HTTP 01 NPM
  • 46. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Events ➢ Node.js follows event-driven architecture where certain objects (called "emitters") periodically emit named events which further invokes the listeners (function). ➢ Node.js provide concurrency by using the concept of events and callbacks ➢ All objects that emit events are instances of the EventEmitter class. var eventEmitter = event.EventEmitter(); Importing ‘events’ module Object of EventEmitter Class eventEmitter.emit(‘event’) Registering listeners Trigger event eventEmitter.on(‘event’, eventHandler) var event = require(‘events’);
  • 47. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Events Import Events Module Creating object of EventEmitter Emitting event Registering Listener and defining event handler OUTPUT
  • 48. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Node.js Modules 02 GLOBALS 03 FILE SYSTEM 04 CALLBACKS 05 EVENT 06 HTTP 01 NPM
  • 49. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Web Application Architecture Client Client Client Client Mobile Browser Web Browser Application Web Server Application Server File System Database External File System Client Server Business Layer Data Layer Makes HTTP Request to the server Serve the request Made by client and pass the response contains application utilized by web server to do required processing. Consists of Database and other data storage
  • 50. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING HTTP Import Required Modules Creating Server Parse the fetched URL to get pathname Request file to be read from file system (index.html) Creating Header with content type as text or HTML Generating Response Listening to port: 3000
  • 51. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING HTTP Index.html Output Node.js cmd
  • 52. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Express
  • 53. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Express Framework ➢ Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. ➢ Inspired by Sinatra (web framework based on Ruby) and also, intertwined with Connect, a “plugin” library for Node. ➢ Express used to come bundled with Connect before version 4.0 ➢ After version 4.0, Connect (and all middleware except static) was removed to allow these middleware to be updated independently
  • 54. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Express Framework Importing express module Retrieve resources Sending html doc as response Listening to port: 3000
  • 55. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING RESTful API REST stands for REpresentational State Transfer. Used create a new resource or update a existing resource 1 POST Used to provide a read only access to a resource 2 GET Used to create a update a resource 3 PUT Used to remove a resource 4 DELETE C R U DCreate Delete Read Update
  • 56. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Popular Frameworks Around Node.js
  • 57. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Popular Frameworks Around Node.js E X P R E S S Minimalistic Web Framework based on Node.js S A I L S Project generator, Middleware and Templating Engine M E T E O R Full Stack Framework that covers server, mobile, desktop & web apps K O A Web Framework designed by the team behind Express N O D E
  • 58. www.edureka.co/mastering-node-jsEDUREKA NODE JS CERTIFICATION TRAINING Demo: Grocery List Web Application
  • 59. EDUREKA NODE JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Thank You … Questions/Queries/Feedback