SlideShare a Scribd company logo
1 of 25
Workshop
@
Ramnshee Infotech
By Jainul Musani
SESSION:01
1
SESSION:01
Node.Js
 Node.js is a cross-platform runtime environment
 Node.js provide a library to run JavaScript applications
outside the browser.
 Node.js is used for creating server-side and networking
web applications.
 It is open source and free to use.
 It can be downloaded from this
link https://nodejs.org/en/
Node.js = Runtime Environment +
JavaScript Library
About Node.js
 Node.js uses
 Event-Driven,
Non-Blocking I/O model
Lightweight and Efficient,
 Perfect for Data-Intensive real-time applications
Run across distributed devices
Node.js is a platform built on Chrome's JavaScript
runtime
easily building fast and scalable network
applications.
SESSION:01
Traditional Web Server Model
SESSION:01
Nodejs Process Model
SESSION:01
Different Parts of Node.js
SESSION:01
Features of Node.js
 1) Extremely fast:
 2) I/O is Asynchronous and Event Driven:
 3) Single threaded:
 4) Highly Scalable:
 5) No buffering:
 6) Open source:
 7) License: under the MIT license.
SESSION:01
Installation of Node.js
SESSION:01
Start with Node.js CLI
SESSION:01
 C:UsersJainul>node
Welcome to Node.js v12.17.0.
Type ".help" for more information.
> _
 > console.log("Good Morning...!!!")
Good Morning...!!!
undefined
Simple Commands with Node.js
 Create a .js file “node1.js”
 Write basic commands of Js and save the file.
Console.log(“Testing”);
Console.log(“Good Morning…!!!”);
 D:UsersJamtemp>node node1.js (.js is optional)
Testing
Good Morning....!!!
 D:UsersJamtemp> _
SESSION:01
Node.js REPL
 Read
 Evaluate
 Print
 Loop
SESSION:01
How to start REPL – (Nodejs CLI)
 C:UsersJainul>node
Welcome to Node.js v12.17.0.
Type ".help" for more information.
> _
 > console.log("Good Morning...!!!")
Good Morning...!!!
undefined
SESSION:01
REPL commands and Features
 Press Ctrl+C to terminate the current command.
Pressing Ctrl + C twice causes the REPL to quit.
Press Ctrl+D to exit the REPL.
 Pressing up and down arrow keys you can see command
history and modify previous commands.
 Press tab key to see the list of current commands. If you
type a single character followed by tab it will show the
list of keywords, functions, and variables starting with
that particular character.
 The REPL can handle multiline expression.
 The REPL provides a special variable _ (underscore)
which is used to pull the result of the last expression.
SESSION:01
REPL commands and Features
> 1+2
3
> 1+2-3
0
> 1+(3-2)*4/2
3
>
SESSION:01
REPL commands and Features
> var x = 10;
undefined
> var y = 20;
undefined
> x+y
30
> console.log(x+y);
30
undefined
>
SESSION:01
Node.js Underscore _ variable
 To get last result use underscore _ variable
> console.clear()
> a = 10
> b = 15
> a+b
25
> console.log(“last sum is: “ + _+5);
last sum is 30
>
SESSION:01
Node.js Loop structure ‘do-while’
 Loop Structure in
Node.js
> var a = 10
undefined
> i = 1
1
> do{
... console.log(i)
... i++;
... }while(i<a);
SESSION:01
>
1
2
3
4
5
6
7
8
9
>
Output:
Node.js Primitive Data Types
 Node.js includes following primitive types:
• String
• Number
• Boolean
• Undefined
• Null
• RegExp
 Everything else is an object in Node.js.
SESSION:01
Node.js Data Types
 Loose Typing
• JavaScript in Node.js supports loose typing like
the browser's JavaScript.
• Use var keyword to declare a variable of any
type.
• Object Literal
var obj = {
authorName: 'Raxit Dilhan',
language: 'Node.js'
}
SESSION:01
Function in NodeJs
File name: func1.js
function display(){
console.log("Function 1");
}
function dispPara(x){
console.log("Function with Para : ", x);
}
display();
dispPara(10);
SESSION:01
Buffer in NodeJs
 Node.js includes an additional data type
called Buffer (not available in browser's
JavaScript).
 Buffer is mainly used to store binary data,
while reading from a file or receiving packets
over the network.
SESSION:01
process object in NodeJs
Each Node.js script runs in a process.
It includes process object to get all the
information about the current process of
Node.js application.
SESSION:01
Defaults to local in NodeJs
Nodejs JavaScript is different from
browser's JavaScript when it comes to
global scope.
In the browser's JavaScript, variables
declared without var keyword become
global.
In Node.js, everything becomes local by
default.
SESSION:01
Access Global Scope in NodeJs
In a browser, global scope is the window
object. In Node.js, global object represents
the global scope.
To add something in global scope, you need
to export it using export or module.export.
The same way, import modules/object using
require() function to access it from the
global scope.
For example, to export an object in
Node.js, use exports.name = object.
SESSION:01
Access Global Scope in NodeJs
exports.mylib = {
 sum: function(a,b) {
 console.log(“Sum = “, a+b);
 },
 greet: function(msg) {
 console.log(“Hello…”, msg);
 }
}
SESSION:01

More Related Content

What's hot

ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentationThanh Tuong
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS Ganesh Kondal
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_jsMicroPyramid .
 
An Introduction to Vuejs
An Introduction to VuejsAn Introduction to Vuejs
An Introduction to VuejsPaddy Lock
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsRob O'Doherty
 
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...Doug Jones
 
React js programming concept
React js programming conceptReact js programming concept
React js programming conceptTariqul islam
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.jsDinesh U
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample applicationAnil Allewar
 
What is Django | Django Tutorial for Beginners | Python Django Training | Edu...
What is Django | Django Tutorial for Beginners | Python Django Training | Edu...What is Django | Django Tutorial for Beginners | Python Django Training | Edu...
What is Django | Django Tutorial for Beginners | Python Django Training | Edu...Edureka!
 
A Brief Introduction to React.js
A Brief Introduction to React.jsA Brief Introduction to React.js
A Brief Introduction to React.jsDoug Neiner
 

What's hot (20)

Express js
Express jsExpress js
Express js
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
Angular overview
Angular overviewAngular overview
Angular overview
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_js
 
An Introduction to Vuejs
An Introduction to VuejsAn Introduction to Vuejs
An Introduction to Vuejs
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
JavaScript: The Good Parts Or: How A C# Developer Learned To Stop Worrying An...
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
Basics of VueJS
Basics of VueJSBasics of VueJS
Basics of VueJS
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
React JS part 1
React JS part 1React JS part 1
React JS part 1
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
Mern stack developement
Mern stack developementMern stack developement
Mern stack developement
 
React js
React jsReact js
React js
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample application
 
Reactjs
Reactjs Reactjs
Reactjs
 
What is Django | Django Tutorial for Beginners | Python Django Training | Edu...
What is Django | Django Tutorial for Beginners | Python Django Training | Edu...What is Django | Django Tutorial for Beginners | Python Django Training | Edu...
What is Django | Django Tutorial for Beginners | Python Django Training | Edu...
 
A Brief Introduction to React.js
A Brief Introduction to React.jsA Brief Introduction to React.js
A Brief Introduction to React.js
 

Similar to Node.js Workshop at Ramnshee Infotech

NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginnersEnoch Joshua
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
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!
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comVan-Duyet Le
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.Mike Brevoort
 
Copmuter Languages
Copmuter LanguagesCopmuter Languages
Copmuter Languagesactanimation
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami SayarFITC
 
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 AssafAhmed Assaf
 
Node Session - 1
Node Session - 1Node Session - 1
Node Session - 1Bhavin Shah
 
LibOS as a regression test framework for Linux networking #netdev1.1
LibOS as a regression test framework for Linux networking #netdev1.1LibOS as a regression test framework for Linux networking #netdev1.1
LibOS as a regression test framework for Linux networking #netdev1.1Hajime Tazaki
 
Top 30 Node.js interview questions
Top 30 Node.js interview questionsTop 30 Node.js interview questions
Top 30 Node.js interview questionstechievarsity
 
Dragoncraft Architectural Overview
Dragoncraft Architectural OverviewDragoncraft Architectural Overview
Dragoncraft Architectural Overviewjessesanford
 

Similar to Node.js Workshop at Ramnshee Infotech (20)

node.js.pptx
node.js.pptxnode.js.pptx
node.js.pptx
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginners
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Node js
Node jsNode js
Node js
 
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
 
Nodejs
NodejsNodejs
Nodejs
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.com
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
 
Copmuter Languages
Copmuter LanguagesCopmuter Languages
Copmuter Languages
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami Sayar
 
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
 
Proposal
ProposalProposal
Proposal
 
Best node js course
Best node js courseBest node js course
Best node js course
 
Node Session - 1
Node Session - 1Node Session - 1
Node Session - 1
 
Nodejs Intro Part One
Nodejs Intro Part OneNodejs Intro Part One
Nodejs Intro Part One
 
LibOS as a regression test framework for Linux networking #netdev1.1
LibOS as a regression test framework for Linux networking #netdev1.1LibOS as a regression test framework for Linux networking #netdev1.1
LibOS as a regression test framework for Linux networking #netdev1.1
 
Top 30 Node.js interview questions
Top 30 Node.js interview questionsTop 30 Node.js interview questions
Top 30 Node.js interview questions
 
Book
BookBook
Book
 
Dragoncraft Architectural Overview
Dragoncraft Architectural OverviewDragoncraft Architectural Overview
Dragoncraft Architectural Overview
 

More from Jainul Musani

More from Jainul Musani (20)

React js t8 - inlinecss
React js   t8 - inlinecssReact js   t8 - inlinecss
React js t8 - inlinecss
 
React js t7 - forms-events
React js   t7 - forms-eventsReact js   t7 - forms-events
React js t7 - forms-events
 
React js t6 -lifecycle
React js   t6 -lifecycleReact js   t6 -lifecycle
React js t6 -lifecycle
 
React js t5 - state
React js   t5 - stateReact js   t5 - state
React js t5 - state
 
React js t4 - components
React js   t4 - componentsReact js   t4 - components
React js t4 - components
 
React js t3 - es6
React js   t3 - es6React js   t3 - es6
React js t3 - es6
 
React js t2 - jsx
React js   t2 - jsxReact js   t2 - jsx
React js t2 - jsx
 
React js t1 - introduction
React js   t1 - introductionReact js   t1 - introduction
React js t1 - introduction
 
ExpressJs Session01
ExpressJs Session01ExpressJs Session01
ExpressJs Session01
 
NodeJs Session03
NodeJs Session03NodeJs Session03
NodeJs Session03
 
NodeJs Session02
NodeJs Session02NodeJs Session02
NodeJs Session02
 
Java exercise1
Java exercise1Java exercise1
Java exercise1
 
Fundamentals of JDBC
Fundamentals of JDBCFundamentals of JDBC
Fundamentals of JDBC
 
Core Java Special
Core Java SpecialCore Java Special
Core Java Special
 
Core Java Special
Core Java SpecialCore Java Special
Core Java Special
 
Cassandra-vs-MongoDB
Cassandra-vs-MongoDBCassandra-vs-MongoDB
Cassandra-vs-MongoDB
 
MongoDB-SESSION03
MongoDB-SESSION03MongoDB-SESSION03
MongoDB-SESSION03
 
MongoDB-SESSION02
MongoDB-SESSION02MongoDB-SESSION02
MongoDB-SESSION02
 
MongoDB-SESION01
MongoDB-SESION01MongoDB-SESION01
MongoDB-SESION01
 
4+1archi
4+1archi4+1archi
4+1archi
 

Recently uploaded

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 

Node.js Workshop at Ramnshee Infotech

  • 2. SESSION:01 Node.Js  Node.js is a cross-platform runtime environment  Node.js provide a library to run JavaScript applications outside the browser.  Node.js is used for creating server-side and networking web applications.  It is open source and free to use.  It can be downloaded from this link https://nodejs.org/en/ Node.js = Runtime Environment + JavaScript Library
  • 3. About Node.js  Node.js uses  Event-Driven, Non-Blocking I/O model Lightweight and Efficient,  Perfect for Data-Intensive real-time applications Run across distributed devices Node.js is a platform built on Chrome's JavaScript runtime easily building fast and scalable network applications. SESSION:01
  • 4. Traditional Web Server Model SESSION:01
  • 6. Different Parts of Node.js SESSION:01
  • 7. Features of Node.js  1) Extremely fast:  2) I/O is Asynchronous and Event Driven:  3) Single threaded:  4) Highly Scalable:  5) No buffering:  6) Open source:  7) License: under the MIT license. SESSION:01
  • 9. Start with Node.js CLI SESSION:01  C:UsersJainul>node Welcome to Node.js v12.17.0. Type ".help" for more information. > _  > console.log("Good Morning...!!!") Good Morning...!!! undefined
  • 10. Simple Commands with Node.js  Create a .js file “node1.js”  Write basic commands of Js and save the file. Console.log(“Testing”); Console.log(“Good Morning…!!!”);  D:UsersJamtemp>node node1.js (.js is optional) Testing Good Morning....!!!  D:UsersJamtemp> _ SESSION:01
  • 11. Node.js REPL  Read  Evaluate  Print  Loop SESSION:01
  • 12. How to start REPL – (Nodejs CLI)  C:UsersJainul>node Welcome to Node.js v12.17.0. Type ".help" for more information. > _  > console.log("Good Morning...!!!") Good Morning...!!! undefined SESSION:01
  • 13. REPL commands and Features  Press Ctrl+C to terminate the current command. Pressing Ctrl + C twice causes the REPL to quit. Press Ctrl+D to exit the REPL.  Pressing up and down arrow keys you can see command history and modify previous commands.  Press tab key to see the list of current commands. If you type a single character followed by tab it will show the list of keywords, functions, and variables starting with that particular character.  The REPL can handle multiline expression.  The REPL provides a special variable _ (underscore) which is used to pull the result of the last expression. SESSION:01
  • 14. REPL commands and Features > 1+2 3 > 1+2-3 0 > 1+(3-2)*4/2 3 > SESSION:01
  • 15. REPL commands and Features > var x = 10; undefined > var y = 20; undefined > x+y 30 > console.log(x+y); 30 undefined > SESSION:01
  • 16. Node.js Underscore _ variable  To get last result use underscore _ variable > console.clear() > a = 10 > b = 15 > a+b 25 > console.log(“last sum is: “ + _+5); last sum is 30 > SESSION:01
  • 17. Node.js Loop structure ‘do-while’  Loop Structure in Node.js > var a = 10 undefined > i = 1 1 > do{ ... console.log(i) ... i++; ... }while(i<a); SESSION:01 > 1 2 3 4 5 6 7 8 9 > Output:
  • 18. Node.js Primitive Data Types  Node.js includes following primitive types: • String • Number • Boolean • Undefined • Null • RegExp  Everything else is an object in Node.js. SESSION:01
  • 19. Node.js Data Types  Loose Typing • JavaScript in Node.js supports loose typing like the browser's JavaScript. • Use var keyword to declare a variable of any type. • Object Literal var obj = { authorName: 'Raxit Dilhan', language: 'Node.js' } SESSION:01
  • 20. Function in NodeJs File name: func1.js function display(){ console.log("Function 1"); } function dispPara(x){ console.log("Function with Para : ", x); } display(); dispPara(10); SESSION:01
  • 21. Buffer in NodeJs  Node.js includes an additional data type called Buffer (not available in browser's JavaScript).  Buffer is mainly used to store binary data, while reading from a file or receiving packets over the network. SESSION:01
  • 22. process object in NodeJs Each Node.js script runs in a process. It includes process object to get all the information about the current process of Node.js application. SESSION:01
  • 23. Defaults to local in NodeJs Nodejs JavaScript is different from browser's JavaScript when it comes to global scope. In the browser's JavaScript, variables declared without var keyword become global. In Node.js, everything becomes local by default. SESSION:01
  • 24. Access Global Scope in NodeJs In a browser, global scope is the window object. In Node.js, global object represents the global scope. To add something in global scope, you need to export it using export or module.export. The same way, import modules/object using require() function to access it from the global scope. For example, to export an object in Node.js, use exports.name = object. SESSION:01
  • 25. Access Global Scope in NodeJs exports.mylib = {  sum: function(a,b) {  console.log(“Sum = “, a+b);  },  greet: function(msg) {  console.log(“Hello…”, msg);  } } SESSION:01