|

Node.js and Windows Azure: Getting Started

If you’re looking for a cloud platform to build and deploy highly scalable Node.js applications and services, Windows Azure is a good fit. It supports a wide variety of programming tools, frameworks, and development tools, including Node.js.

In this post, we’ll take a look at various options for building and deploying Node applications on Windows Azure. If you’re new to Windows Azure, you can sign up for a free trial to get started. Windows Azure development is a vast topic, and here we’ll just focus on the basics of getting up and running with Node.js. To dive deeper, take a look at Chapter 1: Windows Azure Platform Overview in Windows Azure Platform.

There are three ways to deploy Node applications and services on Windows Azure:

As a rule of thumb, you’ll want to use Web Sites for simple projects. For more complex scenarios, you can use Infrastructure Services if you want maximum control of configuration details, or Cloud Services if you want to minimize your ongoing operational responsibilities. Regardless of which you choose, you have two options for deploying and managing your site:

When you create a Windows Azure Web Site there are two options for Node developers. The Node JS Empty Sites is a pre-built website set up with Node.js, and the Node JS Starter Site also includes the popular Express MVC framework.

For spinning up a virtual machine to host your Node applications on Windows Azure Infrastructure Services, there are several options. One is to simply deploy a base OS and then build your preferred Node environment on top of it. This is the quick create option in the Windows Azure management portal, and current OS options include: Windows Server 2012, Windows Server 2008 R2, openSUSE 12.3, SUSE Linux Enterprise Server 11 SP2, OpenLogic CentOS 6.3, or Ubuntu Server versions 12.04 LTS, 12.10, or 13.04.

An even faster way to get a Node.js development environment up and running on Infrastructure Services is to take advantage of the pre-built virtual machine images available on VM Depot, a community-driven catalog of preconfigured operating systems, applications, and development stacks that can easily be deployed on Windows Azure. Current options on VM Depot include Node.js 10.5-0 on Ubuntu 12.10.

Note that Windows Azure Web Sites and Cloud Services provide automated tools for deploying and managing your applications, but with virtual machines you’ll need to use SSH to manage your deployments. This is another factor to take into account when choosing among the Azure options for Node developers.

To get started with Windows Azure cloud services, see the Build and deploy a Node.js application to a Windows Azure Cloud Service tutorial. The New-AzureServiceProject cmdlet sets up the structure for deploying a Cloud Service, and the Add-AzureNodeWebRole cmdlet generates scaffolding for a basic Node.js application. After editing the generated server.js as desired, you can run your application locally in an emulator, which you launch with the Start-AzureEmulator cmdlet.

The entire dev/test/deploy process is automated through the cmdlets, so that you can concentrate on building your application. Similar options are available for Mac and Linux users via the cross-platform command line interface. And regardless of how you create it, your Node.js-based Cloud Service has full access to Azure’s APIs for services such as compute, storage, caching, and messaging (Service Bus). For an overview of the Azure APIs you can use from a Node application, see the GitHub repo for the SDK.

That’s a high-level overview of the options for getting started with Node.js on Windows Azure. See below for books covering Windows Azure as well as Node.js. In future posts we’ll take a closer look at how to take full advantage of Azure services and how to monitor performance of your Node.js applications on Windows Azure.

You can find a wealth of information on Node.js and Windows Azure in the eBooks referenced below.

Safari Books Online has the content you need

Smashing Node.js: JavaScript Everywhere, 2nd Edition equips you with the necessary tools to understand Node.js and its uses in developing efficient web applications. With more traditional web servers becoming obsolete, having knowledge on servers that achieve high scalability and optimal resource consumption using Node.js is the key to your app development success. Teaching you the essentials to making event-driven server-side apps, this book demonstrates how you can use less space and take less time for communication between web client and server.
Professional Node.js: Building Javascript Based Scalable Software is a no nonsense book that begins with an overview of Node.js and then quickly dives into the code, core concepts, and APIs. In-depth coverage pares down the essentials to cover debugging, unit testing, and flow control so that you can start building and testing your own modules right away.
In Windows Azure Platform is divided into three key parts: Windows Azure, SQL Azure, and Windows Azure AppFabric. Each of these plays a unique role in the functioning of your cloud service. It is the goal of this book to show you how to use these components, both separately and together, to build flawless cloud applications as well as hybrid architectures that fit in alongside your business’ existing systems.
Windows Azure Programming Patterns for Start-ups is an incremental guide that will take you from the essentials of the Windows Azure platform up to the realization of your own cloud services running on the platform. You will learn how to apply different technologies of the Windows Azure platform with the help of examples all focusing on one single fictitious start-up scenario.

About the author

Doug Mahugh is lead technical evangelist at Microsoft Open Technologies, Inc., a wholly owned subsidiary of Microsoft Corporation responsible for advancing the company’s investments in interoperability, open source, and open standards. He can be reached at dmahugh@microsoft.com, or on Twitter at @dmahugh.

About Safari Books Online

Safari Books Online is an online learning library that provides access to thousands of technical, engineering, business, and digital media books and training videos. Get the latest information on topics like Windows 8, Android Development, iOS Development, Cloud Computing, HTML5, and so much more – sometimes even before the book is published or on bookshelves. Learn something new today with a free subscription to Safari Books Online.
|

Comments are closed.