SlideShare a Scribd company logo
1 of 20
Developing for Node.js
@debug_mode

Dhananjay Kumar
Agenda









What is this buzz Node
Create first HTTP Server : Demo
How Node works ?
Understanding EventLoop and Callback
Create Echo Server : Demo
Create app to upload large file asynchronously : Demo
Create routers using Crossroads : Demo
Create REST API using Express and Visual Studio : Demo
Your Presenter
 Dhananjay Kumar
– Evangelist , Telerik
– Microsoft MVP
– Mentror C-Sharpcorner
– @debug_mode
– http://debugmode.net
– http://telerikhelper.net
– Dhananjay.kumar@telerik.com
What is Node.js ?

Asynchronous Event Driven Server
Side JavaScript
Runs on Google JS V8 Engine
Non-blocking I/O and File API

Highly Scalable

Single Threaded
Node Apps are created using JavaScript
Faster in performance
Demo : Create first web Server
Let us understand code line by line
Line 1

Line 4

•
•

•
•

•

Loading http module
It is required to work with HTTP
request and response
It is required to create HTTP Server

Line 2
•
•

•
•

Create server using createServer()
function
It takes a callback as parameter . It
takes HTTP request and response
as paramtere
Callback got two input parameter .
Both input parameters are
readable and writeable stream

•

Writing response header
It takes a JSON object as optional
second parameter
second parameter contains
informations like

•
•
•
•

Content Length
Content Type
Connection
Accept Type
Let us understand code line by line
Line 9

Line 5-6
•
•
•

Writing data in response
Data can be written in form of
string or buffer
ServerResponse.end indicates the
communication has been finished

•

•

•

Line 10
•

Printing a message

createServer() method
is finished with chained
http.Server.listen()
method
It specifies port number
on which request will be
listen
Optional host name
How Node works ?
• It works on single thread
• It handles all request asynchronously
on same thread
• It does not create new thread for each
request which is very unlikely like
other web servers
• It does not wait to complete a request

Keep poling for event in
EventLoop

When gets event process
asynchronously and
assign a CallBack

CallBack get executed
once event execution is
complete
Visual Studio and Node

Manage NPM Modules
Events in Node
• Each objects in Node emit an asynchronous
event.
• event is handled by an object EventEmitter.
• EventEmitter is underneath every object.
Streams in Node
Demo on echo server

Demo on uploading file
asynchronously
Routers in Node
Modules to create Routers
Demo add routes using Crossroads

•
•
•
•
•

Express
Director
Bouncy
Backbone
Crossroads
Demo : REST API on Node.js
•
•
•
•
•

Export data from a Module
Add routes in Express
Map routes to function
Test in fiddler
Use Visual Studio Template
Demo : REST API on Node.js
Step 1 : Create JSON Object Array
Demo : REST API on Node.js
Step 2 : Retrieve function
Demo : REST API on Node.js
Step 3 : Add function
Demo : REST API on Node.js
Step 4 : Update function
Demo : REST API on Node.js
Step 5 : Delete function
Demo : REST API on Node.js
Step 5 : Add Routes
Thanks & Questions?
@debug_mode

More Related Content

What's hot

Type script for_java_dev_jul_2020
Type script for_java_dev_jul_2020Type script for_java_dev_jul_2020
Type script for_java_dev_jul_2020Yakov Fain
 
Talk for DevFest 2021 - GDG Bénin
Talk for DevFest 2021 - GDG BéninTalk for DevFest 2021 - GDG Bénin
Talk for DevFest 2021 - GDG BéninEzéchiel Amen AGBLA
 
Angular 2... so can I use it now??
Angular 2... so can I use it now??Angular 2... so can I use it now??
Angular 2... so can I use it now??Laurent Duveau
 
Docker - An Introduction
Docker - An IntroductionDocker - An Introduction
Docker - An IntroductionKnoldus Inc.
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersOswald Campesato
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Knoldus Inc.
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshopAssaf Gannon
 
Building blocks of Angular
Building blocks of AngularBuilding blocks of Angular
Building blocks of AngularKnoldus Inc.
 
Angular 2 Essential Training
Angular 2 Essential Training Angular 2 Essential Training
Angular 2 Essential Training Patrick Schroeder
 
An Intro to Angular 2
An Intro to Angular 2An Intro to Angular 2
An Intro to Angular 2Ron Heft
 
Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6William Marques
 
Angular2 with type script
Angular2 with type scriptAngular2 with type script
Angular2 with type scriptRavi Mone
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5Johannes Weber
 
Angular js - 10 reasons to choose angularjs
Angular js - 10 reasons to choose angularjs Angular js - 10 reasons to choose angularjs
Angular js - 10 reasons to choose angularjs Nir Kaufman
 
Protractor end-to-end testing framework for angular js
Protractor   end-to-end testing framework for angular jsProtractor   end-to-end testing framework for angular js
Protractor end-to-end testing framework for angular jscodeandyou forums
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersLaurent Duveau
 
Angular 2: What's New?
Angular 2: What's New?Angular 2: What's New?
Angular 2: What's New?jbandi
 
Back to the ng2 Future
Back to the ng2 FutureBack to the ng2 Future
Back to the ng2 FutureJeremy Likness
 
Алексей Волков "Введение в React Native"
Алексей Волков "Введение в React Native"Алексей Волков "Введение в React Native"
Алексей Волков "Введение в React Native"Fwdays
 
AngularJS: Service, factory & provider
AngularJS: Service, factory & providerAngularJS: Service, factory & provider
AngularJS: Service, factory & providerCorley S.r.l.
 

What's hot (20)

Type script for_java_dev_jul_2020
Type script for_java_dev_jul_2020Type script for_java_dev_jul_2020
Type script for_java_dev_jul_2020
 
Talk for DevFest 2021 - GDG Bénin
Talk for DevFest 2021 - GDG BéninTalk for DevFest 2021 - GDG Bénin
Talk for DevFest 2021 - GDG Bénin
 
Angular 2... so can I use it now??
Angular 2... so can I use it now??Angular 2... so can I use it now??
Angular 2... so can I use it now??
 
Docker - An Introduction
Docker - An IntroductionDocker - An Introduction
Docker - An Introduction
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshop
 
Building blocks of Angular
Building blocks of AngularBuilding blocks of Angular
Building blocks of Angular
 
Angular 2 Essential Training
Angular 2 Essential Training Angular 2 Essential Training
Angular 2 Essential Training
 
An Intro to Angular 2
An Intro to Angular 2An Intro to Angular 2
An Intro to Angular 2
 
Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6
 
Angular2 with type script
Angular2 with type scriptAngular2 with type script
Angular2 with type script
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5
 
Angular js - 10 reasons to choose angularjs
Angular js - 10 reasons to choose angularjs Angular js - 10 reasons to choose angularjs
Angular js - 10 reasons to choose angularjs
 
Protractor end-to-end testing framework for angular js
Protractor   end-to-end testing framework for angular jsProtractor   end-to-end testing framework for angular js
Protractor end-to-end testing framework for angular js
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
 
Angular 2: What's New?
Angular 2: What's New?Angular 2: What's New?
Angular 2: What's New?
 
Back to the ng2 Future
Back to the ng2 FutureBack to the ng2 Future
Back to the ng2 Future
 
Алексей Волков "Введение в React Native"
Алексей Волков "Введение в React Native"Алексей Волков "Введение в React Native"
Алексей Волков "Введение в React Native"
 
AngularJS: Service, factory & provider
AngularJS: Service, factory & providerAngularJS: Service, factory & provider
AngularJS: Service, factory & provider
 

Similar to Node.js

Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate
 
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.pdf
Introduction to Node JS.pdfIntroduction to Node JS.pdf
Introduction to Node JS.pdfBareen Shaikh
 
Bringing Interactivity to Your Drupal Site with Node.js Integration
Bringing Interactivity to Your Drupal Site with Node.js IntegrationBringing Interactivity to Your Drupal Site with Node.js Integration
Bringing Interactivity to Your Drupal Site with Node.js IntegrationAcquia
 
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.jsGary Yeh
 
Electron. Build cross platform desktop apps with web technologies!
Electron. Build cross platform desktop apps with web technologies!Electron. Build cross platform desktop apps with web technologies!
Electron. Build cross platform desktop apps with web technologies!*instinctools
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescueMarko Heijnen
 
video conference (peer to peer)
video conference (peer to peer)video conference (peer to peer)
video conference (peer to peer)mohamed amr
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
Docker serverless v1.0
Docker serverless v1.0Docker serverless v1.0
Docker serverless v1.0Thomas Chacko
 
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!
 

Similar to Node.js (20)

Introduction to Node.JS
Introduction to Node.JSIntroduction to Node.JS
Introduction to Node.JS
 
What is Node.js
What is Node.jsWhat is Node.js
What is Node.js
 
Real time web
Real time webReal time web
Real time web
 
Hello world - intro to node js
Hello world - intro to node jsHello world - intro to node js
Hello world - intro to node js
 
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
Node jsNode js
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
 
Introduction to Node JS.pdf
Introduction to Node JS.pdfIntroduction to Node JS.pdf
Introduction to Node JS.pdf
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Bringing Interactivity to Your Drupal Site with Node.js Integration
Bringing Interactivity to Your Drupal Site with Node.js IntegrationBringing Interactivity to Your Drupal Site with Node.js Integration
Bringing Interactivity to Your Drupal Site with Node.js Integration
 
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
 
Electron. Build cross platform desktop apps with web technologies!
Electron. Build cross platform desktop apps with web technologies!Electron. Build cross platform desktop apps with web technologies!
Electron. Build cross platform desktop apps with web technologies!
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescue
 
video conference (peer to peer)
video conference (peer to peer)video conference (peer to peer)
video conference (peer to peer)
 
Proposal
ProposalProposal
Proposal
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Docker serverless v1.0
Docker serverless v1.0Docker serverless v1.0
Docker serverless v1.0
 
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
 

More from Dhananjay Kumar

Slides of webinar Kendo UI and Knockout.js
Slides of webinar Kendo UI and Knockout.jsSlides of webinar Kendo UI and Knockout.js
Slides of webinar Kendo UI and Knockout.jsDhananjay Kumar
 
Presenter deck icenium hol
Presenter deck   icenium holPresenter deck   icenium hol
Presenter deck icenium holDhananjay Kumar
 
Windows azure mobile service
Windows azure mobile serviceWindows azure mobile service
Windows azure mobile serviceDhananjay Kumar
 
Test studiowebinaraugcodedstep
Test studiowebinaraugcodedstepTest studiowebinaraugcodedstep
Test studiowebinaraugcodedstepDhananjay Kumar
 
Functions and Objects in JavaScript
Functions and Objects in JavaScript Functions and Objects in JavaScript
Functions and Objects in JavaScript Dhananjay Kumar
 
Create Hybrid Mobile Application with Icenium and Kendo UI Mobile
Create Hybrid Mobile Application with Icenium and Kendo UI Mobile Create Hybrid Mobile Application with Icenium and Kendo UI Mobile
Create Hybrid Mobile Application with Icenium and Kendo UI Mobile Dhananjay Kumar
 
Cloud Based Enterprise Apps using Everlive
Cloud Based Enterprise Apps using EverliveCloud Based Enterprise Apps using Everlive
Cloud Based Enterprise Apps using EverliveDhananjay Kumar
 
A Look into Automated Web UI Test
A Look into Automated Web UI TestA Look into Automated Web UI Test
A Look into Automated Web UI TestDhananjay Kumar
 
Windows phone 8 app using Kendo UI
Windows phone 8 app using Kendo UI Windows phone 8 app using Kendo UI
Windows phone 8 app using Kendo UI Dhananjay Kumar
 
Windows aazuremobileservices
Windows aazuremobileservicesWindows aazuremobileservices
Windows aazuremobileservicesDhananjay Kumar
 
Rad controlforwindows25thapril
Rad controlforwindows25thaprilRad controlforwindows25thapril
Rad controlforwindows25thaprilDhananjay Kumar
 
Windows storemindcrcaker23rdmarch
Windows storemindcrcaker23rdmarchWindows storemindcrcaker23rdmarch
Windows storemindcrcaker23rdmarchDhananjay Kumar
 
Test studio webinar march 2013
Test studio webinar march 2013Test studio webinar march 2013
Test studio webinar march 2013Dhananjay Kumar
 

More from Dhananjay Kumar (20)

Slides of webinar Kendo UI and Knockout.js
Slides of webinar Kendo UI and Knockout.jsSlides of webinar Kendo UI and Knockout.js
Slides of webinar Kendo UI and Knockout.js
 
No SQL with Kendo UI
No SQL with Kendo UI No SQL with Kendo UI
No SQL with Kendo UI
 
Patterns in JavaScript
Patterns in JavaScriptPatterns in JavaScript
Patterns in JavaScript
 
Presenter deck icenium hol
Presenter deck   icenium holPresenter deck   icenium hol
Presenter deck icenium hol
 
Bringbestoinyou
BringbestoinyouBringbestoinyou
Bringbestoinyou
 
Java script
Java scriptJava script
Java script
 
Windows azure mobile service
Windows azure mobile serviceWindows azure mobile service
Windows azure mobile service
 
Test studiowebinaraugcodedstep
Test studiowebinaraugcodedstepTest studiowebinaraugcodedstep
Test studiowebinaraugcodedstep
 
Functions and Objects in JavaScript
Functions and Objects in JavaScript Functions and Objects in JavaScript
Functions and Objects in JavaScript
 
Create Hybrid Mobile Application with Icenium and Kendo UI Mobile
Create Hybrid Mobile Application with Icenium and Kendo UI Mobile Create Hybrid Mobile Application with Icenium and Kendo UI Mobile
Create Hybrid Mobile Application with Icenium and Kendo UI Mobile
 
Cloud Based Enterprise Apps using Everlive
Cloud Based Enterprise Apps using EverliveCloud Based Enterprise Apps using Everlive
Cloud Based Enterprise Apps using Everlive
 
A Look into Automated Web UI Test
A Look into Automated Web UI TestA Look into Automated Web UI Test
A Look into Automated Web UI Test
 
Windows phone 8 app using Kendo UI
Windows phone 8 app using Kendo UI Windows phone 8 app using Kendo UI
Windows phone 8 app using Kendo UI
 
Cross platformmobileapp
Cross platformmobileappCross platformmobileapp
Cross platformmobileapp
 
Windows aazuremobileservices
Windows aazuremobileservicesWindows aazuremobileservices
Windows aazuremobileservices
 
Rad controlforwindows25thapril
Rad controlforwindows25thaprilRad controlforwindows25thapril
Rad controlforwindows25thapril
 
Data asservice
Data asserviceData asservice
Data asservice
 
WCF for begineers
WCF  for begineersWCF  for begineers
WCF for begineers
 
Windows storemindcrcaker23rdmarch
Windows storemindcrcaker23rdmarchWindows storemindcrcaker23rdmarch
Windows storemindcrcaker23rdmarch
 
Test studio webinar march 2013
Test studio webinar march 2013Test studio webinar march 2013
Test studio webinar march 2013
 

Recently uploaded

Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 

Recently uploaded (20)

Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

Node.js

  • 2. Agenda         What is this buzz Node Create first HTTP Server : Demo How Node works ? Understanding EventLoop and Callback Create Echo Server : Demo Create app to upload large file asynchronously : Demo Create routers using Crossroads : Demo Create REST API using Express and Visual Studio : Demo
  • 3. Your Presenter  Dhananjay Kumar – Evangelist , Telerik – Microsoft MVP – Mentror C-Sharpcorner – @debug_mode – http://debugmode.net – http://telerikhelper.net – Dhananjay.kumar@telerik.com
  • 4. What is Node.js ? Asynchronous Event Driven Server Side JavaScript Runs on Google JS V8 Engine Non-blocking I/O and File API Highly Scalable Single Threaded Node Apps are created using JavaScript Faster in performance
  • 5. Demo : Create first web Server
  • 6. Let us understand code line by line Line 1 Line 4 • • • • • Loading http module It is required to work with HTTP request and response It is required to create HTTP Server Line 2 • • • • Create server using createServer() function It takes a callback as parameter . It takes HTTP request and response as paramtere Callback got two input parameter . Both input parameters are readable and writeable stream • Writing response header It takes a JSON object as optional second parameter second parameter contains informations like • • • • Content Length Content Type Connection Accept Type
  • 7. Let us understand code line by line Line 9 Line 5-6 • • • Writing data in response Data can be written in form of string or buffer ServerResponse.end indicates the communication has been finished • • • Line 10 • Printing a message createServer() method is finished with chained http.Server.listen() method It specifies port number on which request will be listen Optional host name
  • 8. How Node works ? • It works on single thread • It handles all request asynchronously on same thread • It does not create new thread for each request which is very unlikely like other web servers • It does not wait to complete a request Keep poling for event in EventLoop When gets event process asynchronously and assign a CallBack CallBack get executed once event execution is complete
  • 9. Visual Studio and Node Manage NPM Modules
  • 10. Events in Node • Each objects in Node emit an asynchronous event. • event is handled by an object EventEmitter. • EventEmitter is underneath every object.
  • 11. Streams in Node Demo on echo server Demo on uploading file asynchronously
  • 12. Routers in Node Modules to create Routers Demo add routes using Crossroads • • • • • Express Director Bouncy Backbone Crossroads
  • 13. Demo : REST API on Node.js • • • • • Export data from a Module Add routes in Express Map routes to function Test in fiddler Use Visual Studio Template
  • 14. Demo : REST API on Node.js Step 1 : Create JSON Object Array
  • 15. Demo : REST API on Node.js Step 2 : Retrieve function
  • 16. Demo : REST API on Node.js Step 3 : Add function
  • 17. Demo : REST API on Node.js Step 4 : Update function
  • 18. Demo : REST API on Node.js Step 5 : Delete function
  • 19. Demo : REST API on Node.js Step 5 : Add Routes

Editor's Notes

  1. https://nodejstools.codeplex.com/releases/view/114437 : download from here
  2. https://nodejstools.codeplex.com/releases/view/114437 : download from here