SlideShare une entreprise Scribd logo
1  sur  41
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Agenda
Why Node.js?
1
What is Node.js?
2
Success Stories
3
Node.js Modules
4
Demo
5
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Why Node.js?
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Client Server Architecture
Client Server Architecture:
Request
Response
DatabasesServer
ApplicationUsers
Interacts
Interacts
Interacts
Interacts
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Multi Thread Model
Each request is handled by a separate thread
DatabasesServerClients Thread
thread A
thread B
thread C
Handle Request
A
Handle Request
B
Handle Request
C
……
Request A
Response A
Request B
Response B
Request C
Response C
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Multi Thread Model
▪ In multi-threaded model, for every request server
creates a separate thread which handles that
request
▪ If a thread acquires a lock in the shared resource
and it is ‘exclusive lock’, it will block other threads.
DatabasesThread Request
C
…
B
A
Handling Request A
Thread B C … are
blocked
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
B
Single Threaded Model
▪ Node.js is event driven, handling all requests asynchronously from single thread
▪ Almost no function in Node directly performs I/O, so the process never blocks
C
A
Event
Emitters
Event Queue
Event Loop
(Single - threaded)
File System
Network
Process
Other
Thread Pool
Users
Databases
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Multi-Threaded vs Event Driven
Multi-Threaded Asynchronous Event-driven
Lock application / request with listener-workers threads Only one thread, which repeatedly fetches an event
Using incoming-request model Using queue and then processes it
Multithreaded server might block the request which might involve
multiple events
Manually saves state and then goes on to process the next event
Using context switching No contention and no context switches
Using multithreading environments where listener and workers
threads are used frequently to take an incoming-request lock
Using asynchronous I/O facilities (callbacks, not poll/select or
O_NONBLOCK) environments
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Uber Story
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Uber Old Architecture
• Since PHP is a multithreaded language , each user’s request is handled in a separate thread
• Reason was car dispatch operation was executed from multiple threads
• Once one car is dispatched for a user, in between the same car get dispatched to another user
MySQL
Database
Server
UBER
Application
PHP for Server-side
scripting
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Uber New Architecture
Real-time Logic
Dispatch State
(MongoDB)
Dispatch (NodeJS)
Business Logic
Python
Persistent Storage
(MySQL)
❖ Well-suited for distributed systems that
make a lot of network requests
❖ Errors can be addressed on the fly without
requiring a restart
❖ Active open source community
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
What is Node.js ?
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
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 and FreeBSD.
▪ Provides an event driven architecture and non blocking I/O that is optimized and scalable.
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Success Stories
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Success Stories
Nexflix used JavaScript and NodeJS to transform
their website into a single page application.
PayPal team developed the application
simultaneously using Java and Javascript. The
JavaScript team build the product both faster
and more efficiently.
Uber has built its massive driver / rider matching
system on Node.js Distributed Web Architecture.
Node enables to build quality applications,
deploy new features, write unit and integration
tests easily.
When LinkedIn went to rebuild their Mobile
application they used Node.js for their Mobile
application server which acts as a REST endpoint
for Mobile devices.
They had two primary requirements: first to
make the application as real time as possible.
Second was to orchestrate a huge number of
eBay-specific services.
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Job Trends
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Node.js Job Trend
Indeed: Job Posting (Node.js)
2017
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Node.js Features
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Node.js Features
Asynchronous and Event Driven :
▪ 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
Caller Recipient
request
response
callback
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js
Node.js Features
No Buffering
Node.js applications never buffer any data. These
applications simply output the data in chunks.
Very Fast
Being built on Google Chrome's V8 JavaScript Engine,
Node.js library is very fast in code execution.
Single Threaded but Highly Scalable
Uses a single threaded model with event looping. Event mechanism
helps the server to respond in a non-blocking way and makes the
server highly scalable as opposed to traditional servers.
Fast Performance
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Node.js Installation
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Node.js First Example
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Node.js First Example
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
Blocking vs Non - Blocking
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
➢ 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
var fs = require("fs");
// Asynchronous read
fs.readFile(‘test.txt', function (err, data) { });
var fs = require("fs");
// Synchronous read
var data = fs.readFileSync('input.txt');
Blocking I/O Non-Blocking I/O
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Node.js
Modules
NPM
GLOBALS
FILE SYSTEM
CALLBACKS
EVENT
HTTP
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
NPM
▪ NPM => Node Package Manager
▪ Provides online repositories for node.js packages/modules
▪ Provides command line utility to install Node.js packages
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
Node.js
Modules
NPM
GLOBALS
FILE SYSTEM
CALLBACKS
EVENT
HTTP
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Global Objects
These objects are available in all modules
specifies the name of the directory that currently contains the code.__dirname
specifies the name of the file that currently contains the code.__filename
A timer in Node.js is an internal construct that calls a given function after a certain period of time
setTimeout(callback, delay[, ...args]) setInterval(callback, delay[, ...args]) setImmediate(callback, [,..args])
1 2 3
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Node.js
Modules
NPM
GLOBALS
FILE SYSTEM
CALLBACKS
EVENT
HTTP
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
File System
File I/O is provided by simple wrappers around standard POSIX functions
FS Methods
Asynchronous
Forms
Synchronous
Forms
var fs = require("fs");
// Asynchronous read
fs.readFile(‘test.txt', function (err, data) { });
var fs = require("fs");
var fs = require("fs");
// Synchronous read
var data = fs.readFileSync('input.txt');
Callback As Last Arg.
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Methods in File System Module
fs.open( path, flags[, mode], callback )
fs.openSync( path, flags[, mode] )
fs.close( fd, callback )
Open File Asynchronously
Open File Synchronously
Closing File
read(fd, buffer, offset, length, position, callback)
readFile(file[, options], callback)
readFileSync(file[, options])
Read Content of a File into Buffer
Reads File Asynchronously
Reads File Synchronously
Opening a File
Reading from a file
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Methods in File System Module
writeFile(file, data[, options], callback)
writeFileSync(file, data[, options])
Open File Asynchronously
Open File Synchronously
Writing in a File
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Node.js
Modules
NPM
GLOBALS
FILE SYSTEM
CALLBACKS
EVENT
HTTP
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
var fs = require("fs");
// Asynchronous read
fs.readFile(‘test.txt', function (err, data) { });
Callback
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
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Node.js
Modules
NPM
GLOBALS
FILE SYSTEM
CALLBACKS
EVENT
HTTP
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Events
▪ Node.js follows event-driven architecture
▪ Certain objects (emitters) periodically emit events which further invokes the listeners
▪ Node.js provide concurrency by using the concept of events and callbacks
▪ All objects that emit events are instances of the EventEmitter class
Import Events Module
Creating object of EventEmitter
Emitting event
Registering Listener and
defining event handler
www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING
Node.js
Modules
NPM
GLOBALS
FILE SYSTEM
CALLBACKS
EVENT
HTTP
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
▪ To use the HTTP server and client one must require('http')
▪ The HTTP interfaces in Node.js are designed to support many features of the protocol
EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/angular-js
Thank You …
Questions/Queries/Feedback

Contenu connexe

Tendances (20)

NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Vue.js
Vue.jsVue.js
Vue.js
 
Fundamental of Node.JS - Internship Presentation - Week7
Fundamental of Node.JS - Internship Presentation - Week7Fundamental of Node.JS - Internship Presentation - Week7
Fundamental of Node.JS - Internship Presentation - Week7
 
Node js
Node jsNode js
Node js
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
 
Build RESTful API Using Express JS
Build RESTful API Using Express JSBuild RESTful API Using Express JS
Build RESTful API Using Express JS
 
Why Vue.js?
Why Vue.js?Why Vue.js?
Why Vue.js?
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Intro to vue.js
Intro to vue.jsIntro to vue.js
Intro to vue.js
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
NestJS
NestJSNestJS
NestJS
 
Node js crash course session 1
Node js crash course   session 1Node js crash course   session 1
Node js crash course session 1
 
Express js
Express jsExpress js
Express js
 
Basics of VueJS
Basics of VueJSBasics of VueJS
Basics of VueJS
 
Universal React apps in Next.js
Universal React apps in Next.jsUniversal React apps in Next.js
Universal React apps in Next.js
 
Use Node.js to create a REST API
Use Node.js to create a REST APIUse Node.js to create a REST API
Use Node.js to create a REST API
 

Similaire à What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js Training | Edureka

Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJSHüseyin BABAL
 
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 FrameworkEdureka!
 
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!
 
Building Applications With the MEAN Stack
Building Applications With the MEAN StackBuilding Applications With the MEAN Stack
Building Applications With the MEAN StackNir Noy
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jibanJibanananda Sana
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS drupalcampest
 
An Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureTroy Miles
 
Node.js tutoria for beginner
Node.js tutoria for beginnerNode.js tutoria for beginner
Node.js tutoria for beginnerManinder Singh
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate
 
Node JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web AppNode JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web AppEdureka!
 
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 developerEdureka!
 
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 DeveloperEdureka!
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Ganesh Kondal
 
Node js installation steps.pptx slide share ppts
Node js installation steps.pptx slide share pptsNode js installation steps.pptx slide share ppts
Node js installation steps.pptx slide share pptsHemaSenthil5
 
Net core vs. node.js what to choose when
Net core vs. node.js  what to choose when Net core vs. node.js  what to choose when
Net core vs. node.js what to choose when Katy Slemon
 

Similaire à What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js Training | Edureka (20)

Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJS
 
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
 
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...
 
Building Applications With the MEAN Stack
Building Applications With the MEAN StackBuilding Applications With the MEAN Stack
Building Applications With the MEAN Stack
 
Node js
Node jsNode js
Node js
 
Introduction to Node.JS
Introduction to Node.JSIntroduction to Node.JS
Introduction to Node.JS
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
Node.js on Azure
Node.js on AzureNode.js on Azure
Node.js on Azure
 
Oracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node finalOracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node final
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
An Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows Azure
 
Node.js tutoria for beginner
Node.js tutoria for beginnerNode.js tutoria for beginner
Node.js tutoria for beginner
 
Live Node.JS Training
Live Node.JS TrainingLive Node.JS Training
Live Node.JS Training
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
 
Node JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web AppNode JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web App
 
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
 
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
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
 
Node js installation steps.pptx slide share ppts
Node js installation steps.pptx slide share pptsNode js installation steps.pptx slide share ppts
Node js installation steps.pptx slide share ppts
 
Net core vs. node.js what to choose when
Net core vs. node.js  what to choose when Net core vs. node.js  what to choose when
Net core vs. node.js what to choose when
 

Plus de 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 | EdurekaEdureka!
 
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 | EdurekaEdureka!
 
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 | EdurekaEdureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaEdureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaEdureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaEdureka!
 
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 | EdurekaEdureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaEdureka!
 
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| EdurekaEdureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaEdureka!
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | EdurekaEdureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEdureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEdureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaEdureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaEdureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaEdureka!
 
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 | EdurekaEdureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaEdureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | EdurekaEdureka!
 

Plus de 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
 
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
 
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
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | 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
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | 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
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | 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
 
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
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 

Dernier

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Dernier (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js Training | Edureka

  • 1.
  • 2. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Agenda Why Node.js? 1 What is Node.js? 2 Success Stories 3 Node.js Modules 4 Demo 5
  • 3. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Why Node.js?
  • 4. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Client Server Architecture Client Server Architecture: Request Response DatabasesServer ApplicationUsers Interacts Interacts Interacts Interacts
  • 5. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Multi Thread Model Each request is handled by a separate thread DatabasesServerClients Thread thread A thread B thread C Handle Request A Handle Request B Handle Request C …… Request A Response A Request B Response B Request C Response C
  • 6. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Multi Thread Model ▪ In multi-threaded model, for every request server creates a separate thread which handles that request ▪ If a thread acquires a lock in the shared resource and it is ‘exclusive lock’, it will block other threads. DatabasesThread Request C … B A Handling Request A Thread B C … are blocked
  • 7. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js B Single Threaded Model ▪ Node.js is event driven, handling all requests asynchronously from single thread ▪ Almost no function in Node directly performs I/O, so the process never blocks C A Event Emitters Event Queue Event Loop (Single - threaded) File System Network Process Other Thread Pool Users Databases
  • 8. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Multi-Threaded vs Event Driven Multi-Threaded Asynchronous Event-driven Lock application / request with listener-workers threads Only one thread, which repeatedly fetches an event Using incoming-request model Using queue and then processes it Multithreaded server might block the request which might involve multiple events Manually saves state and then goes on to process the next event Using context switching No contention and no context switches Using multithreading environments where listener and workers threads are used frequently to take an incoming-request lock Using asynchronous I/O facilities (callbacks, not poll/select or O_NONBLOCK) environments
  • 10. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Uber Old Architecture • Since PHP is a multithreaded language , each user’s request is handled in a separate thread • Reason was car dispatch operation was executed from multiple threads • Once one car is dispatched for a user, in between the same car get dispatched to another user MySQL Database Server UBER Application PHP for Server-side scripting
  • 11. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Uber New Architecture Real-time Logic Dispatch State (MongoDB) Dispatch (NodeJS) Business Logic Python Persistent Storage (MySQL) ❖ Well-suited for distributed systems that make a lot of network requests ❖ Errors can be addressed on the fly without requiring a restart ❖ Active open source community
  • 12. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js What is Node.js ?
  • 13. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js 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 and FreeBSD. ▪ Provides an event driven architecture and non blocking I/O that is optimized and scalable.
  • 15. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Success Stories Nexflix used JavaScript and NodeJS to transform their website into a single page application. PayPal team developed the application simultaneously using Java and Javascript. The JavaScript team build the product both faster and more efficiently. Uber has built its massive driver / rider matching system on Node.js Distributed Web Architecture. Node enables to build quality applications, deploy new features, write unit and integration tests easily. When LinkedIn went to rebuild their Mobile application they used Node.js for their Mobile application server which acts as a REST endpoint for Mobile devices. They had two primary requirements: first to make the application as real time as possible. Second was to orchestrate a huge number of eBay-specific services.
  • 17. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Node.js Job Trend Indeed: Job Posting (Node.js) 2017
  • 18. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Node.js Features
  • 19. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Node.js Features Asynchronous and Event Driven : ▪ 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 Caller Recipient request response callback
  • 20. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/mastering-node-js Node.js Features No Buffering Node.js applications never buffer any data. These applications simply output the data in chunks. Very Fast Being built on Google Chrome's V8 JavaScript Engine, Node.js library is very fast in code execution. Single Threaded but Highly Scalable Uses a single threaded model with event looping. Event mechanism helps the server to respond in a non-blocking way and makes the server highly scalable as opposed to traditional servers. Fast Performance
  • 23. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Node.js First Example 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
  • 26. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Blocking vs Non-Blocking ➢ 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 var fs = require("fs"); // Asynchronous read fs.readFile(‘test.txt', function (err, data) { }); var fs = require("fs"); // Synchronous read var data = fs.readFileSync('input.txt'); Blocking I/O Non-Blocking I/O
  • 27. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Node.js Modules NPM GLOBALS FILE SYSTEM CALLBACKS EVENT HTTP
  • 28. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING NPM ▪ NPM => Node Package Manager ▪ Provides online repositories for node.js packages/modules ▪ Provides command line utility to install Node.js packages 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
  • 29. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Node.js Modules NPM GLOBALS FILE SYSTEM CALLBACKS EVENT HTTP
  • 30. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Global Objects These objects are available in all modules specifies the name of the directory that currently contains the code.__dirname specifies the name of the file that currently contains the code.__filename A timer in Node.js is an internal construct that calls a given function after a certain period of time setTimeout(callback, delay[, ...args]) setInterval(callback, delay[, ...args]) setImmediate(callback, [,..args]) 1 2 3
  • 31. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Node.js Modules NPM GLOBALS FILE SYSTEM CALLBACKS EVENT HTTP
  • 32. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING File System File I/O is provided by simple wrappers around standard POSIX functions FS Methods Asynchronous Forms Synchronous Forms var fs = require("fs"); // Asynchronous read fs.readFile(‘test.txt', function (err, data) { }); var fs = require("fs"); var fs = require("fs"); // Synchronous read var data = fs.readFileSync('input.txt'); Callback As Last Arg.
  • 33. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Methods in File System Module fs.open( path, flags[, mode], callback ) fs.openSync( path, flags[, mode] ) fs.close( fd, callback ) Open File Asynchronously Open File Synchronously Closing File read(fd, buffer, offset, length, position, callback) readFile(file[, options], callback) readFileSync(file[, options]) Read Content of a File into Buffer Reads File Asynchronously Reads File Synchronously Opening a File Reading from a file
  • 34. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Methods in File System Module writeFile(file, data[, options], callback) writeFileSync(file, data[, options]) Open File Asynchronously Open File Synchronously Writing in a File
  • 35. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Node.js Modules NPM GLOBALS FILE SYSTEM CALLBACKS EVENT HTTP
  • 36. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING var fs = require("fs"); // Asynchronous read fs.readFile(‘test.txt', function (err, data) { }); Callback 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
  • 37. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Node.js Modules NPM GLOBALS FILE SYSTEM CALLBACKS EVENT HTTP
  • 38. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Events ▪ Node.js follows event-driven architecture ▪ Certain objects (emitters) periodically emit events which further invokes the listeners ▪ Node.js provide concurrency by using the concept of events and callbacks ▪ All objects that emit events are instances of the EventEmitter class Import Events Module Creating object of EventEmitter Emitting event Registering Listener and defining event handler
  • 39. www.edureka.co/mastering-node-jsEDUREKA NODE.JS CERTIFICATION TRAINING Node.js Modules NPM GLOBALS FILE SYSTEM CALLBACKS EVENT HTTP
  • 40. 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 ▪ To use the HTTP server and client one must require('http') ▪ The HTTP interfaces in Node.js are designed to support many features of the protocol
  • 41. EDUREKA NODE.JS CERTIFICATION TRAINING www.edureka.co/angular-js Thank You … Questions/Queries/Feedback