SlideShare uma empresa Scribd logo
1 de 14
Developing for Node.js in
Visual Studio
@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
Thanks & Questions?
@debug_mode

Mais conteúdo relacionado

Mais procurados

Building cross platform applications using Windows Azure Mobile Services
Building cross platform applications using Windows Azure Mobile ServicesBuilding cross platform applications using Windows Azure Mobile Services
Building cross platform applications using Windows Azure Mobile ServicesKevin DeRudder
 
VISUG: Visual studio for web developers
VISUG: Visual studio for web developersVISUG: Visual studio for web developers
VISUG: Visual studio for web developersKevin DeRudder
 
Visual Studio ❤ JavaScript
Visual Studio ❤ JavaScriptVisual Studio ❤ JavaScript
Visual Studio ❤ JavaScriptRobert MacLean
 
Visual Studio: The best tool for web developers.
Visual Studio: The best tool for web developers.Visual Studio: The best tool for web developers.
Visual Studio: The best tool for web developers.Robert MacLean
 
Building android and i os apps with visual studio
Building android and i os apps with visual studioBuilding android and i os apps with visual studio
Building android and i os apps with visual studioLohith Goudagere Nagaraj
 
Say hello to react js - Day 1
Say hello to react js   - Day 1Say hello to react js   - Day 1
Say hello to react js - Day 1Smile Gupta
 
What’s new in LightSwitch 2013?
What’s new in LightSwitch 2013?What’s new in LightSwitch 2013?
What’s new in LightSwitch 2013?Robert MacLean
 
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
 
Visual Studio Tools for Cordova
Visual Studio Tools for CordovaVisual Studio Tools for Cordova
Visual Studio Tools for CordovaAndrea Tino
 
Angular From The Trenches - 10 Lessons
Angular From The Trenches - 10 LessonsAngular From The Trenches - 10 Lessons
Angular From The Trenches - 10 LessonsDuncan Hunter
 
Building Cross Platform Mobile Apps
Building Cross Platform Mobile AppsBuilding Cross Platform Mobile Apps
Building Cross Platform Mobile AppsShailendra Chauhan
 
Angular JS For Your Business
Angular JS For Your BusinessAngular JS For Your Business
Angular JS For Your BusinessMobiloitte
 
How to build a Mobile API or HTML 5 app in 5 minutes
How to build a Mobile API or HTML 5 app in 5 minutesHow to build a Mobile API or HTML 5 app in 5 minutes
How to build a Mobile API or HTML 5 app in 5 minutesRobert MacLean
 
Modern web applications
Modern web applicationsModern web applications
Modern web applicationsAndrea Tino
 

Mais procurados (20)

Building cross platform applications using Windows Azure Mobile Services
Building cross platform applications using Windows Azure Mobile ServicesBuilding cross platform applications using Windows Azure Mobile Services
Building cross platform applications using Windows Azure Mobile Services
 
VISUG: Visual studio for web developers
VISUG: Visual studio for web developersVISUG: Visual studio for web developers
VISUG: Visual studio for web developers
 
Php development
Php developmentPhp development
Php development
 
Building UWP apps with React-Native
Building UWP apps with React-NativeBuilding UWP apps with React-Native
Building UWP apps with React-Native
 
Visual Studio ❤ JavaScript
Visual Studio ❤ JavaScriptVisual Studio ❤ JavaScript
Visual Studio ❤ JavaScript
 
React Native
React NativeReact Native
React Native
 
Visual Studio: The best tool for web developers.
Visual Studio: The best tool for web developers.Visual Studio: The best tool for web developers.
Visual Studio: The best tool for web developers.
 
Building android and i os apps with visual studio
Building android and i os apps with visual studioBuilding android and i os apps with visual studio
Building android and i os apps with visual studio
 
Say hello to react js - Day 1
Say hello to react js   - Day 1Say hello to react js   - Day 1
Say hello to react js - Day 1
 
The productive developer guide to React
The productive developer guide to ReactThe productive developer guide to React
The productive developer guide to React
 
What’s new in LightSwitch 2013?
What’s new in LightSwitch 2013?What’s new in LightSwitch 2013?
What’s new in LightSwitch 2013?
 
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
 
Visual Studio Tools for Cordova
Visual Studio Tools for CordovaVisual Studio Tools for Cordova
Visual Studio Tools for Cordova
 
Angular From The Trenches - 10 Lessons
Angular From The Trenches - 10 LessonsAngular From The Trenches - 10 Lessons
Angular From The Trenches - 10 Lessons
 
Building Cross Platform Mobile Apps
Building Cross Platform Mobile AppsBuilding Cross Platform Mobile Apps
Building Cross Platform Mobile Apps
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
Angular JS For Your Business
Angular JS For Your BusinessAngular JS For Your Business
Angular JS For Your Business
 
JavaScript Toolkit
JavaScript ToolkitJavaScript Toolkit
JavaScript Toolkit
 
How to build a Mobile API or HTML 5 app in 5 minutes
How to build a Mobile API or HTML 5 app in 5 minutesHow to build a Mobile API or HTML 5 app in 5 minutes
How to build a Mobile API or HTML 5 app in 5 minutes
 
Modern web applications
Modern web applicationsModern web applications
Modern web applications
 

Semelhante a Nodejsvs

Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate
 
video conference (peer to peer)
video conference (peer to peer)video conference (peer to peer)
video conference (peer to peer)mohamed amr
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescueMarko Heijnen
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
Node Session - 1
Node Session - 1Node Session - 1
Node Session - 1Bhavin Shah
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101Rami Sayar
 
Docker serverless v1.0
Docker serverless v1.0Docker serverless v1.0
Docker serverless v1.0Thomas Chacko
 
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
 
What is Node.js? (ICON UK)
What is Node.js? (ICON UK)What is Node.js? (ICON UK)
What is Node.js? (ICON UK)Tim Davis
 
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
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Deepak Gupta
 

Semelhante a Nodejsvs (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
 
Proposal
ProposalProposal
Proposal
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners 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
 
Real time web
Real time webReal time web
Real time web
 
video conference (peer to peer)
video conference (peer to peer)video conference (peer to peer)
video conference (peer to peer)
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescue
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Hello world - intro to node js
Hello world - intro to node jsHello world - intro to node js
Hello world - intro to node js
 
Node Session - 1
Node Session - 1Node Session - 1
Node Session - 1
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
 
Docker serverless v1.0
Docker serverless v1.0Docker serverless v1.0
Docker serverless v1.0
 
Node js
Node jsNode js
Node js
 
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
 
What is Node.js? (ICON UK)
What is Node.js? (ICON UK)What is Node.js? (ICON UK)
What is Node.js? (ICON UK)
 
Introduction to Node JS.pdf
Introduction to Node JS.pdfIntroduction to Node JS.pdf
Introduction to Node JS.pdf
 
Node JS
Node JSNode JS
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
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)
 

Mais de Dhananjay 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
 
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 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
 
Windows8 metro presentationupdated
Windows8 metro presentationupdatedWindows8 metro presentationupdated
Windows8 metro presentationupdatedDhananjay Kumar
 
PPT from Webinar Create Hybrid Mobile Application in 1 hour
PPT from Webinar Create Hybrid Mobile Application in 1 hourPPT from Webinar Create Hybrid Mobile Application in 1 hour
PPT from Webinar Create Hybrid Mobile Application in 1 hourDhananjay Kumar
 

Mais de Dhananjay Kumar (20)

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
 
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
 
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
 
Windows8 metro presentationupdated
Windows8 metro presentationupdatedWindows8 metro presentationupdated
Windows8 metro presentationupdated
 
Radwp
RadwpRadwp
Radwp
 
PPT from Webinar Create Hybrid Mobile Application in 1 hour
PPT from Webinar Create Hybrid Mobile Application in 1 hourPPT from Webinar Create Hybrid Mobile Application in 1 hour
PPT from Webinar Create Hybrid Mobile Application in 1 hour
 

Último

Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 

Último (20)

Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 

Nodejsvs

  • 1. Developing for Node.js in Visual Studio @debug_mode Dhananjay Kumar
  • 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

Notas do Editor

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