Node.js for .NET Developers
David Gaynes
PUBLISHED BY
Microsoft Press
A division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright 2015 by David Gaynes. All rights reserved.
No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher.
Library of Congress Control Number: 2015930568
ISBN: 978-0-7356-6298-8
Printed and bound in the United States of America.
First Printing
Microsoft Press books are available through booksellers and distributors worldwide. If you need support related to this book, email Microsoft Press Book Support at .
This book is provided as-is and expresses the authors views and opinions. The views, opinions and information expressed in this book, including URL and other Internet website references, may change without notice.
Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred.
Microsoft and the trademarks listed at http://www.microsoft.com on the Trademarks webpage are trademarks of the Microsoft group of companies. All other marks are property of their respective owners.
Acquisitions and Developmental Editor: Devon Musgrave
Project Editor: Devon Musgrave
Editorial Production: Waypoint Press (www.waypointpress.com)
Technical Reviewer: Marc Young
Copyeditor: Roger LeBlanc
Indexer: Cristina Yeager
Cover: Twist Creative Seattle
Contents at a Glance
Table of Contents
What do you think of this book? We want to hear from you!
Microsoft is interested in hearing your feedback so we can continually improve our books and learning resources for you. To participate in a brief online survey, please visit:
microsoft.com/learning/booksurvey
Introduction
Node.js is a JavaScript-based, highly scalable, open-source collection of tools used for sophisticated web development. Using your own chosen set of npm modules woven together under the Node.js paradigm, you can build websites of every imaginable type, from e-commerce to interactive games with multiple simultaneous users. In certain types of web applications, Node.js provides solutions to otherwise challenging technical issues.
Node.js is at its best in real-time web applications that require high-volume, low data-intensive processing of requests or in applications that want to employ push technology using web sockets connections. Today, the vast majority of web applications rely on the stateless request-response paradigm. In this paradigm only the client can initiate communication or data transfer. But with Node.js skills you can quickly build web applications with real-time two-way connections in which both the client and server can initiate communication.
Node.js websites are constructed using the standard open web stack composed of HTML, CSS and JavaScript. It allows for commonly used styling libraries to be added to your chosen collection of npm processing modules. Find out why Node.js is becoming a go-to platform for certain uniquely demanding types of web development.
Who should read this book
This book exists to help current .NET web developers learn the essentials of Node.js web development.
Assumptions
This book expects that you have at least a minimal understanding of .NET development and object-oriented programming concepts. With a heavy focus on web development, this book also assumes that you have a basic understanding of ASP.NET, including the core concepts of web development contained in ASP.NET, such as clients and servers, HTML, CSS, JavaScript, and HTTP post/get. The book also assumes that you have an IDE in which to work, specifically a fairly recent version of Visual Studio.
This book might not be for you if...
This book might not be for you if you have no web programming experience or if your interests within web programming are primarily to desig elegant user interfaces.
Organization of this book
This book is divided into nine chapters, which are designed to walk you through every required aspect of doing node.js development. The first few chapters cover the setup and basics of coding in node.js. The middle section of the book focuses on specific techniques within JavaScript that make life much easier when working with node.js. The last few chapters bring it all together to build a working application from end to end including a few special features, such as token-based authentication.
Conventions and features in this book
This book presents information using conventions designed to make the information readable and easy to follow.
The book includes command line and JavaScript sample code, clearly separated from standard text
The book includes references to named open-source modules available on the web. The first reference to each is in bold text
System requirements
You will need the following hardware and software to complete the practice exercises in this book:
One of Windows XP with Service Pack 3 (except Starter Edition), Windows Vista with Service Pack 2 (except Starter Edition), Windows 7/8/10, Windows Server 2003 with Service Pack 2, Windows Server 2003 R2, Windows Server 2008 with Service Pack 2, or Windows Server 2008 R2.
Visual Studio 2010 or later, any edition (web developer for Express Edition products).
SQL Server 2008 Express Edition or higher (2008 or R2 release), with SQL Server Management. Studio 2008 Express or higher (included with Visual Studio, Express Editions require separate download).
A computer that has a 1.6GHz or faster processor (2GHz recommended).
1 GB (32 Bit) or 2 GB (64 Bit) RAM (Add 512 MB if running in a virtual machine or SQL Server Express Editions, more for advanced SQL Server editions).
3.5GB of available hard disk space.
5400 RPM hard disk drive.
DirectX 9 capable video card running at 1024 x 768 or higher-resolution display.
DVD-ROM drive (if installing Visual Studio from DVD).
Internet connection to download software or chapter examples.
Depending on your Windows configuration, you might require Local Administrator rights to install or configure Visual Studio 2010 and SQL Server 2008 products.
Downloads: Code samples