SlideShare uma empresa Scribd logo
1 de 13
Introduction to Node JS
Prepared By:
Prof. Bareen Shaikh
Department of Computer Science,
MIT ACSC, ALNDI(D), PUNE
Topics
2.1 Introduction
2.2 What is Node JS and its advantages
2.3 Traditional Web Server Model
2.4 Node JS Process model
Introduction
• Node.js is an open-source.
• Server side runtime environment.
• Built on Chrome's V8 JavaScript engine.
• It provides an event driven.
• Non-blocking (asynchronous) I/O.
• Cross-platform runtime environment.
• Building highly scalable server-side application.
• Using JavaScript.
• Prog() //parallel asynchronous and non
blocking promsises and callbacks
• { ….. } no stop
• Prog 1() //parallel asynchronous and non
blocking
• {……} stop
What is Node.js
• Node.js is an open source server environment.
• Node.js allows you to run JavaScript on the server.
• Node.js uses asynchronous programming.
• Node.js runs on various platforms (Windows, Linux,
Unix, Mac OS X, etc.)
Advantages of Node.js
• Lightweight framework that includes bare
minimum modules
• Asynchronous by default. So it performs faster than
other frameworks.
• Cross-platform framework that runs on Windows,
MAC or Linux
• Node.js is an open-source framework.
Traditional Web Server Model
• In the traditional web server model, each request is
handled by a dedicated thread from the thread pool.
• If no thread is available in the thread pool at any point
of time then the request waits till the next available
thread.
• Dedicated thread executes a particular request and
does not return to thread pool until it completes the
execution and returns a response.
Node.js Process Model
• Node.js runs in a single process and the application
code runs in a single thread.(less resources)
• User requests to web application will be handled
by a single thread
• All the I/O work or long running job is performed
asynchronously for a particular request.
• So, this single thread doesn't have to wait for the
request to complete and is free to handle the next
request.
• When asynchronous I/O work completes then it
processes the request further and sends the
response.
Node.js Process Model
• An event loop is constantly watching for the events
to be raised for an asynchronous job and executing
callback function when the job completes.
• Internally, Node.js uses libuv for the event loop
which in turn uses internal C++ thread pool to
provide asynchronous I/O.
• Node.js process model increases the performance
and scalability with a few caveats.
• Node.js is not fit for an application which performs
CPU-intensive operations like image processing or
other heavy computation work because it takes
time to process a request and thereby blocks the
single thread.
Node.js Process Model
Why Node.js
• How PHP or ASP handles a file request:
– Sends the task to the computer's file system.
– Waits while the file system opens and reads the file.
– Returns the content to the client.
– Ready to handle the next request.
• How Node.js handles a file request:
– Sends the task to the computer's file system.
– Ready to handle the next request.
– When the file system has opened and read the file, the
server returns the content to the client.
What can Node.js do?
• Node.js can generate dynamic page content.
• Node.js can create, open, read, write, delete, and
close files on the server.
• Node.js can collect form data.
• Node.js can add, delete, modify data in your
database.
continue in next lecture…

Mais conteúdo relacionado

Mais procurados

Best Practice-React
Best Practice-ReactBest Practice-React
Best Practice-React
Yang Yang
 

Mais procurados (20)

Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPM
 
Node.js Basics
Node.js Basics Node.js Basics
Node.js Basics
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Expressjs
ExpressjsExpressjs
Expressjs
 
NextJS, A JavaScript Framework for building next generation SPA
NextJS, A JavaScript Framework for building next generation SPA  NextJS, A JavaScript Framework for building next generation SPA
NextJS, A JavaScript Framework for building next generation SPA
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginners
 
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 ...
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Express js
Express jsExpress js
Express js
 
Javascript by geetanjali
Javascript by geetanjaliJavascript by geetanjali
Javascript by geetanjali
 
Nodejs vatsal shah
Nodejs vatsal shahNodejs vatsal shah
Nodejs vatsal shah
 
Intro to Asynchronous Javascript
Intro to Asynchronous JavascriptIntro to Asynchronous Javascript
Intro to Asynchronous Javascript
 
Best Practice-React
Best Practice-ReactBest Practice-React
Best Practice-React
 
Asp.net
 Asp.net Asp.net
Asp.net
 
Asp.net basic
Asp.net basicAsp.net basic
Asp.net basic
 
MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...
MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...
MEAN Stack - Introduction & Advantages - Why should you switch to MEAN stack ...
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 

Semelhante a Introduction to Node JS.pdf

Semelhante a Introduction to Node JS.pdf (20)

Node js internal
Node js internalNode js internal
Node js internal
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
 
NodeJS ecosystem
NodeJS ecosystemNodeJS ecosystem
NodeJS ecosystem
 
Scalable server component using NodeJS & ExpressJS
Scalable server component using NodeJS & ExpressJSScalable server component using NodeJS & ExpressJS
Scalable server component using NodeJS & ExpressJS
 
Node Architecture.pptx
Node Architecture.pptxNode Architecture.pptx
Node Architecture.pptx
 
Nodejs
NodejsNodejs
Nodejs
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
 
Introduction to Node.JS
Introduction to Node.JSIntroduction to Node.JS
Introduction to Node.JS
 
Building Applications With the MEAN Stack
Building Applications With the MEAN StackBuilding Applications With the MEAN Stack
Building Applications With the MEAN Stack
 
A brief intro to nodejs
A brief intro to nodejsA brief intro to nodejs
A brief intro to nodejs
 
Meanstack overview
Meanstack overviewMeanstack overview
Meanstack overview
 
Nodejs basics
Nodejs basicsNodejs basics
Nodejs basics
 
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
 
NodeJS Concurrency
NodeJS ConcurrencyNodeJS Concurrency
NodeJS Concurrency
 
Mini-Training: Node.js
Mini-Training: Node.jsMini-Training: Node.js
Mini-Training: Node.js
 
Server-side JS with NodeJS
Server-side JS with NodeJSServer-side JS with NodeJS
Server-side JS with NodeJS
 
Node.js Chapter1
Node.js Chapter1Node.js Chapter1
Node.js Chapter1
 

Mais de Bareen Shaikh (11)

Express Generator.pdf
Express Generator.pdfExpress Generator.pdf
Express Generator.pdf
 
Middleware.pdf
Middleware.pdfMiddleware.pdf
Middleware.pdf
 
ExpressJS-Introduction.pdf
ExpressJS-Introduction.pdfExpressJS-Introduction.pdf
ExpressJS-Introduction.pdf
 
Express JS-Routingmethod.pdf
Express JS-Routingmethod.pdfExpress JS-Routingmethod.pdf
Express JS-Routingmethod.pdf
 
FS_module_functions.pptx
FS_module_functions.pptxFS_module_functions.pptx
FS_module_functions.pptx
 
File System.pptx
File System.pptxFile System.pptx
File System.pptx
 
Web Server.pdf
Web Server.pdfWeb Server.pdf
Web Server.pdf
 
NPM.pdf
NPM.pdfNPM.pdf
NPM.pdf
 
NodeJs Modules1.pdf
NodeJs Modules1.pdfNodeJs Modules1.pdf
NodeJs Modules1.pdf
 
NodeJs Modules.pdf
NodeJs Modules.pdfNodeJs Modules.pdf
NodeJs Modules.pdf
 
Introduction to Node JS1.pdf
Introduction to Node JS1.pdfIntroduction to Node JS1.pdf
Introduction to Node JS1.pdf
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 

Introduction to Node JS.pdf

  • 1. Introduction to Node JS Prepared By: Prof. Bareen Shaikh Department of Computer Science, MIT ACSC, ALNDI(D), PUNE
  • 2. Topics 2.1 Introduction 2.2 What is Node JS and its advantages 2.3 Traditional Web Server Model 2.4 Node JS Process model
  • 3. Introduction • Node.js is an open-source. • Server side runtime environment. • Built on Chrome's V8 JavaScript engine. • It provides an event driven. • Non-blocking (asynchronous) I/O. • Cross-platform runtime environment. • Building highly scalable server-side application. • Using JavaScript.
  • 4. • Prog() //parallel asynchronous and non blocking promsises and callbacks • { ….. } no stop • Prog 1() //parallel asynchronous and non blocking • {……} stop
  • 5. What is Node.js • Node.js is an open source server environment. • Node.js allows you to run JavaScript on the server. • Node.js uses asynchronous programming. • Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
  • 6. Advantages of Node.js • Lightweight framework that includes bare minimum modules • Asynchronous by default. So it performs faster than other frameworks. • Cross-platform framework that runs on Windows, MAC or Linux • Node.js is an open-source framework.
  • 7. Traditional Web Server Model • In the traditional web server model, each request is handled by a dedicated thread from the thread pool. • If no thread is available in the thread pool at any point of time then the request waits till the next available thread. • Dedicated thread executes a particular request and does not return to thread pool until it completes the execution and returns a response.
  • 8. Node.js Process Model • Node.js runs in a single process and the application code runs in a single thread.(less resources) • User requests to web application will be handled by a single thread • All the I/O work or long running job is performed asynchronously for a particular request. • So, this single thread doesn't have to wait for the request to complete and is free to handle the next request. • When asynchronous I/O work completes then it processes the request further and sends the response.
  • 9. Node.js Process Model • An event loop is constantly watching for the events to be raised for an asynchronous job and executing callback function when the job completes. • Internally, Node.js uses libuv for the event loop which in turn uses internal C++ thread pool to provide asynchronous I/O. • Node.js process model increases the performance and scalability with a few caveats. • Node.js is not fit for an application which performs CPU-intensive operations like image processing or other heavy computation work because it takes time to process a request and thereby blocks the single thread.
  • 11. Why Node.js • How PHP or ASP handles a file request: – Sends the task to the computer's file system. – Waits while the file system opens and reads the file. – Returns the content to the client. – Ready to handle the next request. • How Node.js handles a file request: – Sends the task to the computer's file system. – Ready to handle the next request. – When the file system has opened and read the file, the server returns the content to the client.
  • 12. What can Node.js do? • Node.js can generate dynamic page content. • Node.js can create, open, read, write, delete, and close files on the server. • Node.js can collect form data. • Node.js can add, delete, modify data in your database.
  • 13. continue in next lecture…