SlideShare a Scribd company logo
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

More Related Content

PPTX
Slides of webinar Kendo UI and Knockout.js
Dhananjay Kumar
 
PPTX
Node.js
Dhananjay Kumar
 
PPTX
Windows phone 8 app using Kendo UI
Dhananjay Kumar
 
PPTX
Asp.net mvc - Better User Experience with Kendo UI
Lohith Goudagere Nagaraj
 
PDF
Use html5 to build what you want, where you want it
Kevin DeRudder
 
PDF
Testing apps with MTM and Tea Foundation Service
Kevin DeRudder
 
PDF
Introduction to React Native
dvcrn
 
PPTX
Create Hybrid Mobile Application with Icenium and Kendo UI Mobile
Dhananjay Kumar
 
Slides of webinar Kendo UI and Knockout.js
Dhananjay Kumar
 
Windows phone 8 app using Kendo UI
Dhananjay Kumar
 
Asp.net mvc - Better User Experience with Kendo UI
Lohith Goudagere Nagaraj
 
Use html5 to build what you want, where you want it
Kevin DeRudder
 
Testing apps with MTM and Tea Foundation Service
Kevin DeRudder
 
Introduction to React Native
dvcrn
 
Create Hybrid Mobile Application with Icenium and Kendo UI Mobile
Dhananjay Kumar
 

What's hot (20)

PDF
Building cross platform applications using Windows Azure Mobile Services
Kevin DeRudder
 
PDF
VISUG: Visual studio for web developers
Kevin DeRudder
 
DOC
Php development
mariaopenwave
 
PDF
Building UWP apps with React-Native
Maurice De Beijer [MVP]
 
PPTX
Visual Studio ❤ JavaScript
Robert MacLean
 
PPTX
React Native
Software Infrastructure
 
PPTX
Visual Studio: The best tool for web developers.
Robert MacLean
 
PPTX
Building android and i os apps with visual studio
Lohith Goudagere Nagaraj
 
PPTX
Say hello to react js - Day 1
Smile Gupta
 
PDF
The productive developer guide to React
Maurice De Beijer [MVP]
 
PPTX
What’s new in LightSwitch 2013?
Robert MacLean
 
PDF
Angular js - 10 reasons to choose angularjs
Nir Kaufman
 
PDF
Visual Studio Tools for Cordova
Andrea Tino
 
PPTX
Angular From The Trenches - 10 Lessons
Duncan Hunter
 
PPTX
Building Cross Platform Mobile Apps
Shailendra Chauhan
 
PPTX
ASP.NET
Robert MacLean
 
PPTX
Angular JS For Your Business
Mobiloitte
 
PPTX
JavaScript Toolkit
Robert MacLean
 
PPTX
How to build a Mobile API or HTML 5 app in 5 minutes
Robert MacLean
 
PDF
Modern web applications
Andrea Tino
 
Building cross platform applications using Windows Azure Mobile Services
Kevin DeRudder
 
VISUG: Visual studio for web developers
Kevin DeRudder
 
Php development
mariaopenwave
 
Building UWP apps with React-Native
Maurice De Beijer [MVP]
 
Visual Studio ❤ JavaScript
Robert MacLean
 
Visual Studio: The best tool for web developers.
Robert MacLean
 
Building android and i os apps with visual studio
Lohith Goudagere Nagaraj
 
Say hello to react js - Day 1
Smile Gupta
 
The productive developer guide to React
Maurice De Beijer [MVP]
 
What’s new in LightSwitch 2013?
Robert MacLean
 
Angular js - 10 reasons to choose angularjs
Nir Kaufman
 
Visual Studio Tools for Cordova
Andrea Tino
 
Angular From The Trenches - 10 Lessons
Duncan Hunter
 
Building Cross Platform Mobile Apps
Shailendra Chauhan
 
Angular JS For Your Business
Mobiloitte
 
JavaScript Toolkit
Robert MacLean
 
How to build a Mobile API or HTML 5 app in 5 minutes
Robert MacLean
 
Modern web applications
Andrea Tino
 
Ad

Similar to Nodejsvs (20)

PDF
540slidesofnodejsbackendhopeitworkforu.pdf
hamzadamani7
 
PPTX
Intro to Node
Aaron Stannard
 
ODP
Introduce about Nodejs - duyetdev.com
Van-Duyet Le
 
PDF
Day In A Life Of A Node.js Developer
Edureka!
 
PDF
Day in a life of a node.js developer
Edureka!
 
PDF
Tech io nodejs_20130531_v0.6
Ganesh Kondal
 
PPTX
Nodejs
Vinod Kumar Marupu
 
PPT
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
PPTX
Introduction to node.js GDD
Sudar Muthu
 
PPTX
Unit 1 Express J for mean stack and mern
Rahul Borate
 
PPT
Introducción y comandos en NodeJS slodte
lmcsenatic
 
PPTX
Introduction to node
girish82
 
PDF
Node.js introduction
Parth Joshi
 
PDF
Node.js introduction
Prasoon Kumar
 
PPTX
Introduction to Node.js
Vikash Singh
 
PDF
Introduction to Node.js
Aaron Rosenberg
 
PPTX
A slightly advanced introduction to node.js
Sudar Muthu
 
PPTX
Proposal
Constantine Priemski
 
PPTX
NodeJS guide for beginners
Enoch Joshua
 
PPTX
Node js
Fatih Şimşek
 
540slidesofnodejsbackendhopeitworkforu.pdf
hamzadamani7
 
Intro to Node
Aaron Stannard
 
Introduce about Nodejs - duyetdev.com
Van-Duyet Le
 
Day In A Life Of A Node.js Developer
Edureka!
 
Day in a life of a node.js developer
Edureka!
 
Tech io nodejs_20130531_v0.6
Ganesh Kondal
 
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
Introduction to node.js GDD
Sudar Muthu
 
Unit 1 Express J for mean stack and mern
Rahul Borate
 
Introducción y comandos en NodeJS slodte
lmcsenatic
 
Introduction to node
girish82
 
Node.js introduction
Parth Joshi
 
Node.js introduction
Prasoon Kumar
 
Introduction to Node.js
Vikash Singh
 
Introduction to Node.js
Aaron Rosenberg
 
A slightly advanced introduction to node.js
Sudar Muthu
 
NodeJS guide for beginners
Enoch Joshua
 
Ad

More from Dhananjay Kumar (20)

PPTX
No SQL with Kendo UI
Dhananjay Kumar
 
PPTX
Patterns in JavaScript
Dhananjay Kumar
 
PPTX
Presenter deck icenium hol
Dhananjay Kumar
 
PPTX
Bringbestoinyou
Dhananjay Kumar
 
PPTX
Java script
Dhananjay Kumar
 
PPTX
Windows azure mobile service
Dhananjay Kumar
 
PPTX
Test studiowebinaraugcodedstep
Dhananjay Kumar
 
PPTX
Functions and Objects in JavaScript
Dhananjay Kumar
 
PPTX
Cloud Based Enterprise Apps using Everlive
Dhananjay Kumar
 
PPTX
A Look into Automated Web UI Test
Dhananjay Kumar
 
PPTX
Cross platformmobileapp
Dhananjay Kumar
 
PPTX
Windows aazuremobileservices
Dhananjay Kumar
 
PPTX
Rad controlforwindows25thapril
Dhananjay Kumar
 
PPTX
Data asservice
Dhananjay Kumar
 
PPTX
WCF for begineers
Dhananjay Kumar
 
PPTX
Windows storemindcrcaker23rdmarch
Dhananjay Kumar
 
PPTX
Test studio webinar march 2013
Dhananjay Kumar
 
PPTX
Windows8 metro presentationupdated
Dhananjay Kumar
 
PPT
Radwp
Dhananjay Kumar
 
PPTX
PPT from Webinar Create Hybrid Mobile Application in 1 hour
Dhananjay Kumar
 
No SQL with Kendo UI
Dhananjay Kumar
 
Patterns in JavaScript
Dhananjay Kumar
 
Presenter deck icenium hol
Dhananjay Kumar
 
Bringbestoinyou
Dhananjay Kumar
 
Java script
Dhananjay Kumar
 
Windows azure mobile service
Dhananjay Kumar
 
Test studiowebinaraugcodedstep
Dhananjay Kumar
 
Functions and Objects in JavaScript
Dhananjay Kumar
 
Cloud Based Enterprise Apps using Everlive
Dhananjay Kumar
 
A Look into Automated Web UI Test
Dhananjay Kumar
 
Cross platformmobileapp
Dhananjay Kumar
 
Windows aazuremobileservices
Dhananjay Kumar
 
Rad controlforwindows25thapril
Dhananjay Kumar
 
Data asservice
Dhananjay Kumar
 
WCF for begineers
Dhananjay Kumar
 
Windows storemindcrcaker23rdmarch
Dhananjay Kumar
 
Test studio webinar march 2013
Dhananjay Kumar
 
Windows8 metro presentationupdated
Dhananjay Kumar
 
PPT from Webinar Create Hybrid Mobile Application in 1 hour
Dhananjay Kumar
 

Recently uploaded (20)

PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
Virus sequence retrieval from NCBI database
yamunaK13
 

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 – [email protected]
  • 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

Editor's Notes

  • #10: https://nodejstools.codeplex.com/releases/view/114437 : download from here
  • #11: https://nodejstools.codeplex.com/releases/view/114437 : download from here