Download - Brownbag on basics of node.js
© Copyright 2012 Avanade Inc. All Rights Reserved.The Avanade name and logo are registered trademarks in the US and other countries.
var about = {Topic: ‘Node.js’,Presenter : 'Jason Park‘
}
Brown Bag SessionQuick tour on Node JS
© Copyright 2012 Avanade Inc. All Rights Reserved. 2
Who’s talking
• Singapore Avanade App Dev family
• ASP.NET (MVC) / C# guy
• Tech lover
© Copyright 2012 Avanade Inc. All Rights Reserved. 3
What is Node JS?
• Node.js uses an event-driven, non-blocking
I/O model that makes it lightweight and
efficient, perfect for data-intensive real-time
applications that run across distributed
devices
NodeJS.org
© Copyright 2012 Avanade Inc. All Rights Reserved. 4
What is Node JS?
• 2nd most popular project in GitHub
© Copyright 2012 Avanade Inc. All Rights Reserved. 5
What is Node JS?
• Server-side Javascript
• Event-driven
• Built on Chrome V8 engine
• NPM (like NuGet for .NET)
© Copyright 2012 Avanade Inc. All Rights Reserved. 6
What is Node JS?
© Copyright 2012 Avanade Inc. All Rights Reserved. 7
Server-Side JS?
• But wait, server-side JS[1] has been around since
1996!
• What's makes Node JS so special?
[1] Netscape Enterprise Server
© Copyright 2012 Avanade Inc. All Rights Reserved. 8
Speed
• Handles thousands of requests/sec with no
performance degradation
• Ideal for hosting a single-page application - highly
concurrent server application
© Copyright 2012 Avanade Inc. All Rights Reserved. 9
Speed
© Copyright 2012 Avanade Inc. All Rights Reserved. 10
How?
• Keep slow operations from blocking other operations
© Copyright 2012 Avanade Inc. All Rights Reserved. 11
How?
© Copyright 2012 Avanade Inc. All Rights Reserved. 12
How?
• 1 Threaded Application
PROS: Good for conceptual simplicityCONS: Bad for CPU-bound algorithm
© Copyright 2012 Avanade Inc. All Rights Reserved. 13
How?
• Traditional I/O
© Copyright 2012 Avanade Inc. All Rights Reserved. 14
How?
• JavaScript is already geared towards event-based programming
© Copyright 2012 Avanade Inc. All Rights Reserved. 15
How?
• Async I/O
No need to wait for disk.Do something else meanwhile!
© Copyright 2012 Avanade Inc. All Rights Reserved. 16
HTTP Server
© Copyright 2012 Avanade Inc. All Rights Reserved. 17
TCP Server
© Copyright 2012 Avanade Inc. All Rights Reserved. 18
© Copyright 2012 Avanade Inc. All Rights Reserved. 19
Consider Node JS if you
• Want to have a website handling large number of
concurrent connections
• Want to quickly build an Ajax-rich web application
• Want to learn JavaScript/Event-based programming
© Copyright 2012 Avanade Inc. All Rights Reserved. 20
Consider other options if you
• Want something mature
• Want a framework with enterprise-level security
proven in the market
• Need IDE like Visual Studio for coding
© Copyright 2012 Avanade Inc. All Rights Reserved. 21
Big Names using Node JS
• Microsoft
– Azure & WebMatrix support
• Linked In
– Mobile application running on Node JS
• Wallmart
– Mobile application running on Node JS
© Copyright 2012 Avanade Inc. All Rights Reserved. 22
Questions?