<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Shiju Varghese's Blog</title><link>https://weblogs.asp.net:443/shijuvarghese/</link><description>Cloud First and Mobile First</description><item><title>Microsoft MVP For Sixth Time</title><link>https://weblogs.asp.net:443/shijuvarghese/azuremvp-2015</link><description>&lt;p style="box-sizing: border-box; margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;I am delighted to announce that I have been awarded Microsoft Most Valuable Professional 2015 award in Microsoft Azure.This is my sixth Microsoft MVP award in a row (2010 - 2015).&amp;nbsp;&lt;/p&gt;
&lt;p style="box-sizing: border-box; margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;&lt;img src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/mvplogo.jpg" style="box-sizing: border-box; vertical-align: middle; max-width: 100%; height: auto;" /&gt;&lt;/p&gt;
&lt;p style="box-sizing: border-box; margin: 0px 0px 10px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;On this occasion, I would like to thank Microsoft, Community leaders, MVP India Lead and finally Developers who are following my blogs and open-source projects. I would like to also thank my mother Rosy, my lovely wife Rosmi and my daughter Irene Rose.&amp;nbsp;&lt;/p&gt;</description><pubDate>Wed, 01 Jul 2015 15:00:02 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/azuremvp-2015</guid><category>Azure</category></item><item><title>Using Azure Event Hubs As A Message Hub For IoT Scenarios</title><link>https://weblogs.asp.net:443/shijuvarghese/IoTEventHub</link><description>&lt;p&gt;&amp;nbsp;When we build apps for larger IoT scenarios or working on Big Data solutions, one major challenge would be to handle millions of messages received from hundreds of systems where these messages will be subscribed by hundreds of other systems. To handle this kind of problem using our traditional enterprise messaging systems and publish-subscribe message brokers would be really a challenge as we need to handle massive amount of stream of data in a second, in which we may need to process the data and events in near real-time. Our most of the existing publish-subscribe message brokers would be failed when we deal with millions of messages in a second. Technologies like &lt;a href="http://kafka.apache.org/"&gt;Apache Kafka&lt;/a&gt; solves this problem by providing a high-throughput distributed messaging system with a distributed commit log. Kafka is designed for cluster-centric design where you may need to leverage distributed coordination tools such as &lt;a href="https://zookeeper.apache.org/"&gt;Apache ZooKeeper&lt;/a&gt; for coordinating and synchronizing the cluster nodes. This may leads to lot of operational complexity when working with larger distributed systems.&lt;/p&gt;
&lt;p&gt;Azure Event Hubs provide easy provisioning of capacity to ingest events from millions of devices while preserving event order on a per device basis. Support for AMQP and HTTP allow many platforms to work with Event Hubs. Native client libraries also exist for popular platforms. Azure Event Hubs is a brilliant technology which can be used as Event Hub / Message Hub for your modern apps, especially for your IoT apps and Big Data solutions. Azure Event Hubs is Cloud powered managed service so that it removes the complexity for provisioning, managing, scaling of your brokered systems.&lt;/p&gt;
&lt;p&gt;We have developed an example app for using Azure Event Hubs as a message hub for IoT (Internet of Things) scenarios. The project source is available on github at &lt;a href="https://github.com/AccelNA/azure-guidance/tree/master/EventHub" target="_blank"&gt;https://github.com/AccelNA/azure-guidance/tree/master/EventHub&lt;/a&gt;. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is the details for the example app:&lt;/p&gt;
&lt;h2&gt;Technologies:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Azure Event Hub&lt;/li&gt;
&lt;li&gt;Azure App Services Web App&lt;/li&gt;
&lt;li&gt;SignalR&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-solution-architecture" class="anchor" href="https://github.com/AccelNA/azure-guidance/blob/master/IoTEventHub.md#solution-architecture" aria-hidden="true" style="box-sizing: border-box; color: #4183c4; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background-color: transparent;"&gt;&lt;/a&gt;Solution Architecture&lt;/h2&gt;
&lt;p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6000003814697px;"&gt;&lt;a href="https://github.com/AccelNA/azure-guidance/blob/master/contents/eventhub.JPG" target="_blank" style="box-sizing: border-box; color: #4183c4; text-decoration: none; background-color: transparent;"&gt;&lt;img src="https://github.com/AccelNA/azure-guidance/raw/master/contents/eventhub.JPG" alt="alt tag" style="box-sizing: border-box; max-width: 100%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-problem-domain" class="anchor" href="https://github.com/AccelNA/azure-guidance/blob/master/IoTEventHub.md#problem-domain" aria-hidden="true" style="box-sizing: border-box; color: #4183c4; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background-color: transparent;"&gt;&lt;/a&gt;Problem Domain&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Build a message hub for IoT scenarios for sending millions of messages and events to the Cloud at massive scale, with low latency and high reliability.&lt;/li&gt;
&lt;li&gt;Process the massive amounts of messages and events in near real-time.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-apps-in-the-demo" class="anchor" href="https://github.com/AccelNA/azure-guidance/blob/master/IoTEventHub.md#apps-in-the-demo" aria-hidden="true" style="box-sizing: border-box; color: #4183c4; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background-color: transparent;"&gt;&lt;/a&gt;Apps in the Demo:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/AccelNA/azure-guidance/tree/master/EventHub/AndroidApps/IOTDevice" style="box-sizing: border-box; color: #4183c4; text-decoration: none; background-color: transparent;"&gt;Android app&lt;/a&gt;&amp;nbsp;representing automotive vehicles.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/AccelNA/azure-guidance/tree/master/EventHub/AndroidApps/EventHubSender" style="box-sizing: border-box; color: #4183c4; text-decoration: none; background-color: transparent;"&gt;Android app&lt;/a&gt;&amp;nbsp;for receiving messages from IoT devices and sending it to IoT Message Hub.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/AccelNA/azure-guidance/tree/master/EventHub/RealTimeIOTTracker" style="box-sizing: border-box; color: #4183c4; text-decoration: none; background-color: transparent;"&gt;Real-time web app&lt;/a&gt;&amp;nbsp;for receiving messages from IoT Message Hub and providing real-time insight into the browser UI.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-solution-workflow" class="anchor" href="https://github.com/AccelNA/azure-guidance/blob/master/IoTEventHub.md#solution-workflow" aria-hidden="true" style="box-sizing: border-box; color: #4183c4; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background-color: transparent;"&gt;&lt;/a&gt;Solution Workflow&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;When automotive vehicles are moving towards roads, notify the GPS Coordinates to Android app for sending these events into an IoT Message Hub powered by Azure Event Hub. (For the sake of the demo, we use an Android app instead of automotive vehicles)&lt;/li&gt;
&lt;li&gt;The Android app which receives the events from automotive vehicles, send the messages and events into IoT Message Hub.&lt;/li&gt;
&lt;li&gt;A real-time web app running on Azure App Services Web App receives the events from IoT Message Hub and provide real-time insight on the data received.&lt;/li&gt;
&lt;/ol&gt;
&lt;p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6000003814697px;"&gt;&lt;a href="https://github.com/AccelNA/azure-guidance/blob/master/contents/IOTTracker-web-app.png" target="_blank" style="box-sizing: border-box; color: #4183c4; text-decoration: none; background-color: transparent;"&gt;&lt;img src="https://github.com/AccelNA/azure-guidance/raw/master/contents/IOTTracker-web-app.png" alt="alt tag" style="box-sizing: border-box; max-width: 100%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-azure-services" class="anchor" href="https://github.com/AccelNA/azure-guidance/blob/master/IoTEventHub.md#azure-services" aria-hidden="true" style="box-sizing: border-box; color: #4183c4; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background-color: transparent;"&gt;&lt;/a&gt;Azure Services&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Azure Event Hub &amp;ndash; Working as the IoT Message Hub.&lt;/li&gt;
&lt;li&gt;Azure App Services Web App &amp;ndash; Running the real-time web app with SignalR.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Source Code&lt;/h2&gt;
&lt;p&gt;The project source including two android apps and a ASP.NET SignalR app is available here:&amp;nbsp;&lt;a href="https://github.com/AccelNA/azure-guidance/tree/master/EventHub/" target="_blank"&gt;https://github.com/AccelNA/azure-guidance/tree/master/EventHub/&lt;/a&gt;&amp;nbsp;&lt;/p&gt;</description><pubDate>Wed, 06 May 2015 06:14:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/IoTEventHub</guid><category>Azure</category><category>IoT</category></item><item><title>Building Distributed Cloud Apps With Azure WebSites, WebJobs And Azure Service Bus Topic</title><link>https://weblogs.asp.net:443/shijuvarghese/azureguidance-webjobs</link><description>&lt;p&gt;In my previous blog post,&amp;nbsp;&lt;a href="http://weblogs.asp.net/shijuvarghese/azureguidance" target="_blank"&gt;Building Distributed Cloud Apps With Azure Cloud Services And Azure Service Bus Topic&lt;/a&gt;, I have introduced a reference Azure app for developing multi-tiered distributed apps using Azure Cloud services and Azure Service Bus Topic. In that app, we have used two Azure worker roles for running a background processing system and a Notification Hub. This app is same like the previous one, the only difference here is that we are replacing two Azure worker roles with two WebJobs and running in a Azure &amp;nbsp;WebSite. In the previous system, we have used a one Azure web role and two Azure worker roles for an ordr processing demo app. Here we replace these three systems with one WebSite, which is also working as the host for two WebJobs. In short, we replace the worker role with WebJobs. The extra functionality which we have added in this version is the distributed caching with Azure Redis cache.&lt;/p&gt;
&lt;p&gt;The project repository is available here:&amp;nbsp;&lt;a href="https://github.com/AccelNA/azure-guidance" target="_blank"&gt;https://github.com/AccelNA/azure-guidance&lt;/a&gt;&amp;nbsp;and the source code of this drop is available here: &lt;a href="https://github.com/AccelNA/azure-guidance/tree/master/WebSite" target="_blank"&gt;https://github.com/AccelNA/azure-guidance/tree/master/WebSite&amp;nbsp;&amp;nbsp;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Here is the infomration about the sample app:&lt;/span&gt;&lt;/p&gt;
&lt;h3 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;Technologies:&lt;/h3&gt;
&lt;ul class="task-list" style="box-sizing: border-box; padding: 0px 0px 0px 2em; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6000003814697px;"&gt;
&lt;li style="box-sizing: border-box;"&gt;Azure Web Sites&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Azure WebJobs&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Azure Service Bus Topic&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Azure Notification Hub&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Azure DocumentDB&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Azure Redis Cache&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-solution-architecture-1" class="anchor" href="https://github.com/AccelNA/azure-guidance#solution-architecture-1" aria-hidden="true" style="box-sizing: border-box; color: #4183c4; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background: transparent;"&gt;&lt;/a&gt;Solution Architecture&lt;/h3&gt;
&lt;p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6000003814697px;"&gt;&lt;a href="https://github.com/AccelNA/azure-guidance/blob/master/contents/azure-arch-webjobs.JPG" target="_blank" style="box-sizing: border-box; color: #4183c4; text-decoration: none; background: transparent;"&gt;&lt;img src="https://github.com/AccelNA/azure-guidance/raw/master/contents/azure-arch-webjobs.JPG" alt="alt tag" style="box-sizing: border-box; max-width: 100%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-problem-domain-1" class="anchor" href="https://github.com/AccelNA/azure-guidance#problem-domain-1" aria-hidden="true" style="box-sizing: border-box; color: #4183c4; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background: transparent;"&gt;&lt;/a&gt;Problem Domain&lt;/h3&gt;
&lt;ol class="task-list" style="box-sizing: border-box; padding: 0px 0px 0px 2em; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6000003814697px;"&gt;
&lt;li style="box-sizing: border-box;"&gt;Order processing app in a distributed computing environment.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Application logic should be deployed into multiple components.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;An order request from customer, should notify to multiple systems &amp;ndash; including order processing system and a Notification Hub.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Cross platform mobile apps should be able to receive real-time push notifications from Cloud powered systems.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;A RESTful API for working as backend for mobile apps.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Cost effectiveness is important for this system.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-solution-workflow-1" class="anchor" href="https://github.com/AccelNA/azure-guidance#solution-workflow-1" aria-hidden="true" style="box-sizing: border-box; color: #4183c4; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background: transparent;"&gt;&lt;/a&gt;Solution Workflow&lt;/h3&gt;
&lt;ol class="task-list" style="box-sizing: border-box; padding: 0px 0px 0px 2em; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6000003814697px;"&gt;
&lt;li style="box-sizing: border-box;"&gt;End user submits an order through a web app, which is hosted in Azure Web Site. The Web Site is also hosting two WebJobs: a WebJob for performing order processing logic and another WebJob for sending real-time mobile push notifications.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;The Azure Web Site publishes a message into Azure Service Bus Topic for the subscribers of the distributed systems environment.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;A WebJob running in a Azure Web Site subscribes the message from Azure Service Bus Topic , and then process the order and finally persist the data into a NoSQL Database &amp;ndash; Azure DocumentDB.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;A notification hub running in a WebJobs, subscribes the message from Azure Service Bus Topic, and then send cross platform, real-time push notifications to mobile apps running in Android, iOS and Windows Phone.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;The web app hosted in Azure Web Site shows the status of orders which is processed in the WebJob which performs order processing logic.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Mobile apps are consuming REST API hosted in Azure web site.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-azure-services-1" class="anchor" href="https://github.com/AccelNA/azure-guidance#azure-services-1" aria-hidden="true" style="box-sizing: border-box; color: #4183c4; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background: transparent;"&gt;&lt;/a&gt;Azure Services&lt;/h3&gt;
&lt;ol class="task-list" style="box-sizing: border-box; padding: 0px 0px 0px 2em; margin-top: 0px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6000003814697px; margin-bottom: 0px !important;"&gt;
&lt;li style="box-sizing: border-box;"&gt;Web Site&amp;ndash; Used for running web app for receiving orders from customers. The Web Site is also hosting two WebJobs.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;WebJob - WebJob - Background worker for receiving messages from Service Bus Topic and then processing the orders.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;WebJob - Background worker for receiving messages from Service Bus Topic and then sends real-time push notifications to 2. cross platform mobile apps.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Service Bus &amp;ndash; Working as a message broker&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Notification Hub &amp;ndash; Sending cross platform push notifications.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;DocumentDB &amp;ndash; NoSQL data store.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Web Site &amp;ndash; Used for running RESTful API.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Redis Cache - Distributed caching.&lt;/li&gt;
&lt;/ol&gt;</description><pubDate>Mon, 30 Mar 2015 09:24:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/azureguidance-webjobs</guid><category>Azure</category><category>service bus</category></item><item><title>Building Distributed Cloud Apps With Azure Cloud Services And Azure Service Bus Topic</title><link>https://weblogs.asp.net:443/shijuvarghese/azureguidance</link><description>&lt;p&gt;We have been developing few sample apps for providing guidance on building cloud apps with Microsoft Azure. We release the first sample app for building distributed apps on Microsoft Azure. The guidance app is available on github at&amp;nbsp;&lt;a href="https://github.com/AccelNA/azure-guidance" target="_blank"&gt;https://github.com/AccelNA/azure-guidance&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is the infomration about the sample app:&lt;/p&gt;
&lt;h3 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;Technologies:&lt;/h3&gt;
&lt;ul class="task-list" style="box-sizing: border-box; padding: 0px 0px 0px 2em; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6000003814697px;"&gt;
&lt;li style="box-sizing: border-box;"&gt;Azure Cloud Services
&lt;ul class="task-list" style="box-sizing: border-box; padding: 0px 0px 0px 2em; margin-top: 0px; margin-bottom: 0px;"&gt;
&lt;li style="box-sizing: border-box;"&gt;Web Role&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Worker Role&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Azure Service Bus Topic&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Azure Notification Hub&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Azure DocumentDB&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Azure Web Sites&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-solution-architecture" class="anchor" href="https://github.com/AccelNA/azure-guidance#solution-architecture" aria-hidden="true" style="box-sizing: border-box; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background: transparent;"&gt;&lt;/a&gt;Solution Architecture&lt;/h3&gt;
&lt;p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6000003814697px;"&gt;&lt;a href="https://github.com/AccelNA/azure-guidance/blob/master/contents/azure-arch.JPG" target="_blank" style="box-sizing: border-box; text-decoration: none; background: transparent;"&gt;&lt;img src="https://github.com/AccelNA/azure-guidance/raw/master/contents/azure-arch.JPG" alt="alt tag" style="box-sizing: border-box; max-width: 100%;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-problem-domain" class="anchor" href="https://github.com/AccelNA/azure-guidance#problem-domain" aria-hidden="true" style="box-sizing: border-box; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background: transparent;"&gt;&lt;/a&gt;Problem Domain&lt;/h3&gt;
&lt;ol class="task-list" style="box-sizing: border-box; padding: 0px 0px 0px 2em; margin-top: 0px; margin-bottom: 16px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6000003814697px;"&gt;
&lt;li style="box-sizing: border-box;"&gt;Order processing app in a distributed computing environment.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Application logic should be deployed into multiple systems so that individual systems can separately scale-up and scale-down in Cloud.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;An order request from customer, should notify to multiple systems &amp;ndash; including mobile apps.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Cross platform mobile apps should be able to receive real-time push notifications from Cloud powered systems.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;A RESTful API for working as backend for mobile apps.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.43; font-size: 1.5em; position: relative; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;"&gt;&lt;a id="user-content-solution-workflow" class="anchor" href="https://github.com/AccelNA/azure-guidance#solution-workflow" aria-hidden="true" style="box-sizing: border-box; text-decoration: none; position: absolute; top: 0px; left: 0px; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px; line-height: 1.2; background: transparent;"&gt;&lt;/a&gt;Solution Workflow&lt;/h3&gt;
&lt;ol class="task-list" style="box-sizing: border-box; padding: 0px 0px 0px 2em; margin-top: 0px; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6000003814697px; margin-bottom: 0px !important;"&gt;
&lt;li style="box-sizing: border-box;"&gt;End user submits an order through a web app which hosted in Azure web role.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;The Azure web role publishes a message into Azure Service Bus Topic for the subscribers of the system in a distributed computing environment.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;A worker processor running in a Azure worker role subscribes the message from Azure Service Bus Topic , then process the order and finally persist the data into a NoSQL Database &amp;ndash; Azure DocumentDB.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;A notification hub hosted in Azure worker role subscribes the message from Azure Service Bus Topic, then send cross platform, real-time push notifications to mobile apps running in Android, iOS and Windows Phone.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;The web app hosted in Azure web role shows the status of orders which is processed in worker processor.&lt;/li&gt;
&lt;li style="box-sizing: border-box;"&gt;Mobile apps are consuming REST API hosted in Azure web site.&lt;/li&gt;
&lt;/ol&gt;</description><pubDate>Fri, 13 Mar 2015 05:56:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/azureguidance</guid><category>Azure</category><category>service bus</category></item><item><title>DocumentDB - NoSQL Database As A Service On Azure</title><link>https://weblogs.asp.net:443/shijuvarghese/documentdb-microsoft-s-new-nosql-database-as-a-service-on-azure</link><description>&lt;p&gt;Microsoft Azure team has announced a new NoSQL database named "&lt;span style="font-family: Calibri, sans-serif; font-size: 11pt; line-height: 115%;"&gt;DocumentDB".&amp;nbsp;&lt;/span&gt;DocumentDB is a fully managed, massively scalable, NoSQL database as a service on the Microsoft Azure cloud platform. This is a right movement from Microsoft as the existing Table storage was not effcient comparing to other NoSQL databases available in the market. In my initial evalution, DocumentDB is the most feature rich NoSQL databse comparing to many popular NoSQL database. &amp;nbsp;In DocumentDB, we can write&amp;nbsp;Trigger, Stored Procedure and User Defined Function (UDF) in JavaScript.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here's the highlight of the DocumentDB:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Elastically scalable&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Shcema-free database&lt;/li&gt;
&lt;li&gt;JavaScript as a language for writing query and transaction processing (JavaScript as a modern replacement for T-SQL)&lt;/li&gt;
&lt;li&gt;JSON based document model&lt;/li&gt;
&lt;li&gt;HTTP for transportation protocol.&lt;/li&gt;
&lt;li&gt;ACID transactions with snapshot isolation&lt;/li&gt;
&lt;li&gt;LINQ query provider for .NET&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="MsoNormal"&gt;Here's the link for some resources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://azure.microsoft.com/en-us/services/documentdb/" target="_blank"&gt;DocumentDB service web site&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://azure.microsoft.com/en-us/documentation/articles/documentdb-introduction/" target="_blank"&gt;Introduction to Microsoft Azure DocumentDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://azure.microsoft.com/en-us/documentation/articles/documentdb-sql-query/" target="_blank"&gt;Query DocumentDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.documentdb.com/javascript/tutorial" target="_blank"&gt;DocumentDB programming: Stored procedures, triggers, and UDFs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://dl.windowsazure.com/documentDB/jsserverdocs/" target="_blank"&gt;DocumentDB server side JavaScript SDK&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://azure.microsoft.com/en-us/documentation/articles/documentdb-consistency-levels/" target="_blank"&gt;Consistency levels in DocumentDB&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><pubDate>Fri, 22 Aug 2014 06:03:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/documentdb-microsoft-s-new-nosql-database-as-a-service-on-azure</guid><category>Azure</category><category>NoSQL</category></item><item><title>Sample App With ASP.NET Web API and ReactJS</title><link>https://weblogs.asp.net:443/shijuvarghese/sample-app-with-asp-net-web-api-and-reactjs</link><description>&lt;p&gt;We have just started a sample app for demonstrate building apps with ReactJS and ASP.NET Web API. &amp;nbsp;An early version of the app can available on github at &lt;a href="https://github.com/shijuvar/react-aspnet" target="_blank"&gt;https://github.com/shijuvar/react-aspnet&lt;/a&gt; . Please note that the ReactJS version of the app is not a final version, but it is an early version which will continuously refactor with a proper Flux architecture. The RESTful API written with ASP.NET Web API 2.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why ReactJS&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We have been using MVC for building web apps and REST services for long time. At server-side, MVC is really good choice for building web apps. At one day, someone else has started to use MVC for building client-side apps too and provided a MVC framework for front-end apps. Then everyone followed that convention for solving all kinds of problems in client-side apps. IMHO, using MVC for client-side apps is really bad idea and I believe that MVC doesn't scale at larger cleint-side apps. The real beauty of ReactJS is that it is keeping away from existing conventions and patterns and trying to bring some practical solutions for solving the problem around building larger front-end apps which can be easily scale-up with recommended architecture practices such as &lt;a href="http://facebook.github.io/react/docs/flux-overview.html" target="_blank"&gt;Flux&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://facebook.github.io/react/index.html" target="_blank"&gt;React&lt;/a&gt; is a JavaScript library developed by Facebook and Instagram team, for building user interfaces. The entire front-end of Instagram web site and some parts of the Facebook web site built with ReactJS. Interestingly, you can use ReactJS with other front-end frameworks such as AngularJS and EmberJS. You can use ReactJS as the view part along with MVC frameworks. &amp;nbsp;But, in practice, I don't recommend to use ReactJS with traditional MVC frameworks. ReactJS introduces Virtual DOM, which is awesome part of the ReactJS library and it enables high performance for the rendering of UI. ReactJS provides better performance for the UI rendering than MVC frameworks such as AngularJS and EmberJS. You can build re-usable UI components with the Virtual DOM abstraction and later we can compose these components on the actual DOM. For scaling front-end apps, we can use&lt;a href="http://facebook.github.io/react/docs/flux-overview.html" target="_blank"&gt; Flux&lt;/a&gt; architecture which is basically set of architecture practices, that provides data flows in a single direction. I have evaluated BackboneJS, EmberJS, AngularJS and React and highly recommend React for building user interfaces. &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Source Code&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The source code is avaialble in github at&amp;nbsp;&lt;a href="https://github.com/shijuvar/react-aspnet" target="_blank"&gt;https://github.com/shijuvar/react-aspnet&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;</description><pubDate>Fri, 15 Aug 2014 11:44:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/sample-app-with-asp-net-web-api-and-reactjs</guid><category>ASP.NET</category><category>ASP.NET Web API</category><category>React</category><category>JavaScript</category></item><item><title>Microsoft MVP On Microsoft Azure</title><link>https://weblogs.asp.net:443/shijuvarghese/microsoft-mvp-on-microsoft-azure</link><description>&lt;p&gt;I am delighted to announce that I have been awarded Microsoft Most Valuable Professional 2014 award in Microsoft Azure.This is my fifth Microsoft MVP award in a row. Last four years, I was received Microsoft MVP award for my contributions to ASP.NET, but this time I am honoured with Microsoft Azure MVP award.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/mvplogo.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;On this occasion, I would like to thank Microsoft, Community leaders, MVP India Lead and finally Developers who are following my blog and open-source projects.&lt;/p&gt;</description><pubDate>Wed, 02 Jul 2014 06:54:00 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/microsoft-mvp-on-microsoft-azure</guid><category>Azure</category><category>Community News</category></item><item><title>Using Azure Redis Cache As A Persistent Storage For ASP.NET Session State</title><link>https://weblogs.asp.net:443/shijuvarghese/using-azure-redis-cache-as-a-persistent-storage-for-asp-net-session-state</link><description>&lt;p&gt;&lt;font face="Calibri" size="3"&gt;In this post, I will demonstrate how to use Azure Redis Cache for storing ASP.NET session state. In Azure, In-Proc session mode does not work as our application will be working with sticky sessions on a load balancing scenario. In this context, ASP.NET&amp;nbsp; session state and caching do not work so that we have to put ASP.NET state information on a persistent storage. And it is very important that we should develop the cloud apps in stateless manner so that we can easily scale our apps. In Azure, we can leverage the following storage options as a persistent storage for storing ASP.NET state information.&lt;/font&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;font face="Calibri" size="3"&gt;Azure Cache &amp;amp; Azure Redis Cache&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font face="Calibri" size="3"&gt;Azure Table storage&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font face="Calibri" size="3"&gt;SQL Azure&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;font face="Calibri" size="3"&gt;&lt;br&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Calibri" size="3"&gt;In this post, let’s focus on Azure Redis Cache for storing ASP.NET Session state. Azure Redis Cache is a high performance caching service on the Azure, based on the open source Redis cache. Redis has been widely used as session store by many developer communities due to its simplicity and high performance.&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Calibri" size="3"&gt;The information below provides how to use Azure Redis Cache for storing ASP.NET session state.&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Calibri" size="4"&gt;&lt;strong&gt;Step 1 – Create Azure Redis Cache&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Calibri" size="3"&gt;In the &lt;a href="https://portal.azure.com" target="_blank"&gt;Azure portal&lt;/a&gt;, create a new Azure Redis Cache as shown in the below figure.&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Windows-Live-Writer/Using-Azure-Redis-Cach.NET-Session-State_91F2/image_2.png"&gt;&lt;img width="283" height="508" title="image" style="display: inline; background-image: none;" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Windows-Live-Writer/Using-Azure-Redis-Cach.NET-Session-State_91F2/image_thumb.png" border="0"&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Calibri" size="3"&gt;Figure 1 – Creating new Azure Redis Cache&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Calibri" size="3"&gt;Once you have created the Cache, you can browse the cache services from the Caches section. The figure below shows the summary of Cache in which we can take the properties such as Host Name, Port and SSL Port, and Keys which can be used for connect our client apps with Cache service. Let’s copy the properties and keys of Cache for communicate our client apps with Azure Redis Cache.&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Windows-Live-Writer/Using-Azure-Redis-Cach.NET-Session-State_91F2/image_4.png"&gt;&lt;img width="488" height="408" title="image" style="display: inline; background-image: none;" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Windows-Live-Writer/Using-Azure-Redis-Cach.NET-Session-State_91F2/image_thumb_1.png" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;font face="Calibri" size="3"&gt;Figure 2 – Summary of the Azure Redis Cache&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Calibri" size="3"&gt;&lt;br&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Calibri" size="4"&gt;&lt;strong&gt;Step 2 – Configure the ASP.NET App with ASP.NET Session State Provider for Redis&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Calibri" size="3"&gt;In the previous step, we have created a Cache service on the Azure Redis Cache. Let’s configure our ASP.NET app, in order to use Azure Redis Cache for storing ASP.NET Session values. Microsoft provides an ASP.NET Session state provider for Redis which is available as a NuGet package named &lt;a href="https://www.nuget.org/packages/Microsoft.Web.RedisSessionStateProvider" target="_blank"&gt;RedisSessionStateProvider&lt;/a&gt;. You can install this using Package Manager console with the following command. &lt;/font&gt;&lt;/p&gt;&lt;p&gt;PM&amp;gt;&lt;strong&gt; Install-Package Microsoft.Web.RedisSessionStateProvider –Pre&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Calibri" size="3"&gt;If you are using Manage NuGet&amp;nbsp; packages windows, don’t forget to choose the “Include Prerelease” as the this package is currently running in the preview version. When we install the RedisSessionStateProvider package, it will automatically add the following on the web.config file for configure the Azure Redis cache as the storage for ASP.NET Session state provider.&lt;/font&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sessionState&lt;/span&gt; &lt;span class="attr"&gt;mode&lt;/span&gt;&lt;span class="kwrd"&gt;="Custom"&lt;/span&gt; 
                 &lt;span class="attr"&gt;customProvider&lt;/span&gt;&lt;span class="kwrd"&gt;="MySessionStateStore"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;providers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;     
        &lt;span class="rem"&gt;&amp;lt;!--&lt;/span&gt;
&lt;span class="rem"&gt;          &amp;lt;add name="MySessionStateStore" &lt;/span&gt;
&lt;span class="rem"&gt;            host = "127.0.0.1" [String]&lt;/span&gt;
&lt;span class="rem"&gt;            port = "" [number]&lt;/span&gt;
&lt;span class="rem"&gt;            accessKey = "" [String]&lt;/span&gt;
&lt;span class="rem"&gt;            ssl = "false" [true|false]&lt;/span&gt;
&lt;span class="rem"&gt;            throwOnError = "true" [true|false]&lt;/span&gt;
&lt;span class="rem"&gt;            retryTimeoutInMilliseconds = "0" [number]&lt;/span&gt;
&lt;span class="rem"&gt;            databaseId = "0" [number]&lt;/span&gt;
&lt;span class="rem"&gt;            applicationName = "" [String]&lt;/span&gt;
&lt;span class="rem"&gt;          /&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;        --&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="MySessionStateStore"&lt;/span&gt; 
          &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="Microsoft.Web.Redis.RedisSessionStateProvider"&lt;/span&gt; 
         &lt;span class="attr"&gt;host&lt;/span&gt;&lt;span class="kwrd"&gt;="127.0.0.1"&lt;/span&gt; &lt;span class="attr"&gt;accessKey&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; 
          &lt;span class="attr"&gt;ssl&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;providers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;sessionState&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;&lt;p&gt;&lt;font face="Calibri" size="3"&gt;From azure portal, let’s copy the properties and access key and put the values on the configuration. Now we can use ASP.NET Session state in a normal manner where we can store and read values from Session, which will be use Azure Redis cache as the storage mechanism for your ASP.NET apps. These apps will be easily scalable on the Azure cloud as the Session state values are storing in a persistent storage. &lt;/font&gt;&lt;/p&gt;</description><pubDate>Mon, 30 Jun 2014 06:41:38 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/using-azure-redis-cache-as-a-persistent-storage-for-asp-net-session-state</guid><category>Azure</category><category>ASP.NET</category></item><item><title>ASP.NET Web API/AngularJS SPA Demo App Updated (webapi-angularjs-spa v1.2.0)</title><link>https://weblogs.asp.net:443/shijuvarghese/asp-net-web-api-angularjs-spa-demo-app-updated-webapi-angularjs-spa-v1-2-0</link><description>&lt;p&gt;We have released an updated version for the&amp;nbsp;single page application (SPA) demo built with ASP.NET Web API 2 and AngularJS. The current version (v1.2.0) of the demo app available on github at &lt;a href="https://github.com/MarlabsInc/webapi-angularjs-spa" target="_blank"&gt;https://github.com/MarlabsInc/webapi-angularjs-spa&lt;/a&gt;.&amp;nbsp;The following are the new features added in the&amp;nbsp;webapi-angularjs-spa v1.2.0:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;Added unit tests for client-side JavaScript with Jasmine.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;Added paging with ng-Table.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;Role based security for both server-side and client-side.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here are the complete set of features in the current version:&lt;/p&gt;
&lt;ul style="font-size: 13px;"&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;REST API with ASP.NET Web API 2.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;Server-Side security with ASP.NET Identity.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;Single Page Application(SPA) with AngularJS.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;AngularJS factory $resource for interacting with RESTful server-side data sources.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;AngularJS $http interceptors.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;AngularJS directives.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;Task automation with Gulp.js&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;Unit tests for client-side JavaScript with Jasmine.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;Paging using ng-Table.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: 13px;"&gt;Role based security.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="font-size: 13px;"&gt;&lt;strong&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;JavaScript Unit Tests With Jasmine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;In the current release, we have included unit tests for client-side JavaScripts, written with Jasmine. This provides unit tests for AngularJS Conrollers and Services. To run the unit tests, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;navigate to the directory of ResourceMetadata.Web project in command prompt, and run the command &lt;strong&gt;gulp tests&amp;nbsp;&lt;/strong&gt;which will redirect to the page&amp;nbsp;SpecRunner.html, where results of the tests can view as shown in the below figure.&lt;/p&gt;
&lt;p style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;strong&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt; &lt;img width="549" height="465" alt="" src="https://aspblogs.blob.core.windows.net:443/media/shijuvarghese/Media/jasmine.PNG" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;strong&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;Role Based Security For The SPA&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;The current version provides role based security for &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px;"&gt;both server-side and client-side. The write opeartions for Location entity is restricted with admin user. For a normal user, UI elements for creating new Location is removed when the view templates are loading and the templates will put on the cache.&lt;/span&gt;&lt;/p&gt;
&lt;p style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;The figure below shows the UI of Location page for a normal user.&lt;/span&gt;&lt;/p&gt;
&lt;p style="font-size: 13px;"&gt;&lt;img width="819" height="225" alt="" src="https://aspblogs.blob.core.windows.net:443/media/shijuvarghese/Media/Locations%20screen%20as%20Member.PNG" /&gt;&lt;/p&gt;
&lt;p style="font-size: 13px;"&gt;The figure below shows the UI of Location page for a admin user.&lt;/p&gt;
&lt;p style="font-size: 13px;"&gt;&lt;img width="819" height="229" alt="" src="https://aspblogs.blob.core.windows.net:443/media/shijuvarghese/Media/Locations%20screen%20as%20Admin.PNG" /&gt;&lt;/p&gt;
&lt;p style="font-size: 13px;"&gt;&lt;/p&gt;
&lt;p style="font-size: 13px;"&gt;&lt;strong style="font-size: 13px;"&gt;Source Code&lt;/strong&gt;&lt;/p&gt;
&lt;p style="font-size: 13px;"&gt;For more information on the project and to download the source code, check out&amp;nbsp;&lt;a href="https://github.com/MarlabsInc/webapi-angularjs-spa" target="_blank" style="font-size: 13px;"&gt;https://github.com/MarlabsInc/webapi-angularjs-spa&lt;/a&gt;&lt;/p&gt;
&lt;p style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;strong&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="font-size: 13px;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;</description><pubDate>Wed, 28 May 2014 07:05:37 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/asp-net-web-api-angularjs-spa-demo-app-updated-webapi-angularjs-spa-v1-2-0</guid><category>.Net</category><category>ASP.NET Web API</category><category>AngularJS</category><category>Node.js</category></item><item><title>Pub/Sub In Node.js Apps Using Azure Service Bus Topics</title><link>https://weblogs.asp.net:443/shijuvarghese/pub-sub-in-node-js-apps-using-azure-service-bus-topics</link><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In my previous post &lt;a href="http://weblogs.asp.net/shijuvarghese/archive/2014/04/14/building-distributed-node-js-apps-with-azure-service-bus-queue.aspx" target="_blank"&gt;Building Distributed Node.js Apps with Azure Service Bus Queue&lt;/a&gt;, we have discussed how we can design distributed apps in Node.js by leveraging Microsoft Azure Service Bus Queues. Service Bus Queue provides brokered communication between apps regardless of whether hosted on Cloud or on-premises server. Service Bus Queue is designed for delivering the brokered messages to single consumer or an app. We can say that Service Bus Queue is providing a one-to-one communication infrastructure. But, in many scenarios, we may need to deliver the brokered messages to multiple consumers or apps, where we can use Azure Service Bus Topics and Subscriptions which provides a one-to-many communication with a publish/subscribe pattern. Service Bus Topics are built on the top of Service Bus Queues for working with publish/subscribe scenarios. In this post, I will take a look at Azure Service Bus Topics and Subscriptions for implementing publish/subscribe pattern in Node.js apps.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;font size="4"&gt;&lt;strong&gt;Create Azure Service Bus Topics For Publishing Messages to Subscribers&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In order to working with Azure Service Bus, we need to create a Service Bus namespace from &lt;/font&gt;&lt;a href="https://portal.azure.com/"&gt;&lt;font size="3" face="Calibri"&gt;Azure portal&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt;. if you need a free trial account in Azure, you can get it from &lt;a href="http://azure.microsoft.com/en-us/pricing/free-trial/" target="_blank"&gt;here&lt;/a&gt;. Let’s create a Service Bus Topics to be consumed for subscribers of our distributed application.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="3" face="Calibri"&gt;Creating Azure Service Bus Client&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Firstly, we need to install npm module &lt;strong&gt;azure&lt;/strong&gt; to working with Azure services from Node.js app.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font size="3" face="Calibri"&gt;npm install azure&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below creates a Service Bus client object using the Node.js module azure.&lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azure = require(&lt;span class="str"&gt;'azure'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; config=require(&lt;span class="str"&gt;'./config'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; serviceBusClient = azure.createServiceBusService(&lt;/pre&gt;

  &lt;pre&gt;                   config.sbConnection);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;We create the Service Bus client object by using createServiceBusService method of azure module. In the above code block, we pass the Service Bus connection string from a config file. The azure module can also read the environment variables AZURE_SERVICEBUS_NAMESPACE and AZURE_SERVICEBUS_ACCESS_KEY for information required to connect with Azure Service Bus where we can call&amp;#160; createServiceBusService method without specifying the connection information. We can set the environment variables for our Node.js app in the Azure developer portal for Azure Website and Azure Cloud Services apps.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Create Azure Service Bus Topic&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the previous step, we have created the Service Bus client object. Let’s create a Topics for publishing messages for its subscribers. &lt;/font&gt;&lt;font size="3" face="Calibri"&gt;The createTopicIfNotExists method of Service Bus client object, will create a new Topic or returns an existing Topic.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; topic = &lt;span class="str"&gt;'orders'&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; createTopic() {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="rem"&gt;//Create topic&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    serviceBusClient.createTopicIfNotExists(topic, &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt;(!error){&lt;/pre&gt;

  &lt;pre class="alt"&gt;            console.log(&lt;span class="str"&gt;'Topic created or exists.'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    });&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The figure below shows that we have created Topic with name “orders”.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_451EDD2D.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_4A8D4DD1.png" width="609" height="153" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Create Azure Service Bus Subscriptions For Topics&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Azure Service Bus Subscriptions can subscribe the messages published by &lt;font size="3" face="Calibri"&gt;Azure Service Bus Topics. In order to subscribe the messages published by the Topics, we have to create Subscriptions for the Topics. &lt;/font&gt;We can create Azure Service Bus Subscriptions by using createSubscription method of Service Bus client object. &lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; createSubscription(subscriber) {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="rem"&gt;// Create subscription&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;serviceBusClient.createSubscription(topic, subscriber,&lt;/pre&gt;

  &lt;pre&gt; &lt;span class="kwrd"&gt;function&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre&gt;            console.log(error);&lt;/pre&gt;

  &lt;pre class="alt"&gt;        }&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        {&lt;/pre&gt;

  &lt;pre&gt;            console.log(&lt;span class="str"&gt;'Subscriber '&lt;/span&gt;+ subscriber+ &lt;span class="str"&gt;' &lt;/pre&gt;

  &lt;pre class="alt"&gt;              registered for '&lt;/span&gt;+ topic+ &lt;span class="str"&gt;' messages'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    });&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Typically, these subscribers will be different apps in a distributed app environment&lt;/font&gt;. &lt;font size="3" face="Calibri"&gt;Let’s create couple of subscribers for the sake of the demo.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; subscription1 = &lt;span class="str"&gt;'supplier1'&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; subscription2 = &lt;span class="str"&gt;'supplier2'&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;createSubscription(subscription1);&lt;/pre&gt;

  &lt;pre class="alt"&gt;createSubscription(subscription2);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The figure below shows that two subscriptions registered in the Azure portal for the Topics “orders”&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_56429503.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_6D8D9974.png" width="642" height="188" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Publishing Messages from Azure Service Bus Topic Messages&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s create Topic messages to later be consumed from subscriber apps.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; sendMessage(message) {&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="rem"&gt;// Send messages for subscribers&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    serviceBusClient.sendTopicMessage(topic, message, &lt;/pre&gt;

  &lt;pre&gt;   &lt;span class="kwrd"&gt;function&lt;/span&gt;(error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre&gt;            console.log(error);&lt;/pre&gt;

  &lt;pre class="alt"&gt;        }&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;else&lt;/span&gt; {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            console.log(&lt;span class="str"&gt;'Message sent'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    });&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s send couple of Topic messages &lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; orderMessage1={&lt;span class="str"&gt;&amp;quot;OrderId&amp;quot;&lt;/span&gt;:101,&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="str"&gt;&amp;quot;OrderDate&amp;quot;&lt;/span&gt;: &lt;span class="kwrd"&gt;new&lt;/span&gt; Date().toDateString()};&lt;/pre&gt;

  &lt;pre class="alt"&gt;sendMessage(JSON.stringify(orderMessage1));&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; orderMessage2={&lt;span class="str"&gt;&amp;quot;OrderId&amp;quot;&lt;/span&gt;:102,&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="str"&gt;&amp;quot;OrderDate&amp;quot;&lt;/span&gt;: &lt;span class="kwrd"&gt;new&lt;/span&gt; Date().toDateString()};&lt;/pre&gt;

  &lt;pre&gt;sendMessage(JSON.stringify(orderMessage2));&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Receiving Messages from Azure Service Bus Subscriptions&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Subscriber apps can receive the message from Topics by using the method receiveSubscriptionMessage. The code block below reads the messages from Topics for two times. This will read the two messages we have published from Topics in the previous steps. &lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; receiveMessages(subscriber) {&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="rem"&gt;// Receive the messages for subscription.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    serviceBusClient.receiveSubscriptionMessage(topic, subscriber,&lt;/pre&gt;

  &lt;pre&gt; &lt;span class="kwrd"&gt;function&lt;/span&gt; (error1, message1) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (error1) {&lt;/pre&gt;

  &lt;pre&gt;            console.log(error1);&lt;/pre&gt;

  &lt;pre class="alt"&gt;        } &lt;span class="kwrd"&gt;else&lt;/span&gt; {&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; topicMessage1 = JSON.parse(message1.body);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            console.log(&lt;span class="str"&gt;'Processing Order# '&lt;/span&gt; + topicMessage1.OrderId&lt;/pre&gt;

  &lt;pre&gt;                + &lt;span class="str"&gt;' placed on '&lt;/span&gt; + topicMessage1.OrderDate+ ' from ' + subscriber);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="rem"&gt;//call for receive next message&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;            serviceBusClient.receiveSubscriptionMessage(topic, subscriber,&lt;/pre&gt;

  &lt;pre class="alt"&gt;      &lt;span class="kwrd"&gt;function&lt;/span&gt; (error2, message2) {&lt;/pre&gt;

  &lt;pre&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (error2) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    console.log(error2);&lt;/pre&gt;

  &lt;pre&gt;                } &lt;span class="kwrd"&gt;else&lt;/span&gt; {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    &lt;span class="kwrd"&gt;var&lt;/span&gt; topicMessage2 = JSON.parse(message2.body);&lt;/pre&gt;

  &lt;pre&gt;                    console.log(&lt;span class="str"&gt;'Processing Order# '&lt;/span&gt; + topicMessage2.OrderId&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        + &lt;span class="str"&gt;' placed on '&lt;/span&gt; + topicMessage1.OrderDate+ ' from ' + subscriber);&lt;/pre&gt;

  &lt;pre&gt;                }&lt;/pre&gt;

  &lt;pre class="alt"&gt;            });&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    });&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Unlike Service Bus Queues, which provides brokered messages for one app, &lt;font size="3" face="Calibri"&gt;Azure Service Bus Topics and Subscriptions can be used for subscribing messages for multiple apps. In the previous steps, we have created a Topic named “orders” where we have published two messages. We have registered two subscribers for subscribing the messages from Topics. Let’s call the method receiveMessages for our two subscribers.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;receiveMessages(subscription1);&lt;/pre&gt;

  &lt;pre&gt;receiveMessages(subscription2);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The below console window shows that two messages published from the order Topics received from the two subscribers. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_7942E0A6.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_428585A2.png" width="562" height="111" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Source Code&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The source code for the sample code, is available at &lt;a title="https://github.com/shijuvar/azureservicebus-demos" href="https://github.com/shijuvar/azureservicebus-demos"&gt;https://github.com/shijuvar/azureservicebus-demos&lt;/a&gt;. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Scaling Socket.IO Apps with Azure Service Bus Topics&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;By leveraging the Azure Service Bus Topics, we can scale out Socket.io apps to multiple processes and multiple servers. Node.js module &lt;a href="https://github.com/Azure/socket.io-servicebus" target="_blank"&gt;socket.io-servicebus&lt;/a&gt; can be used for scale out Socket.io apps, where Service Bus Topics are working as a store model for Socket.io. The Pub/Sub nature of Azure Service Bus Topics is ideal for working as a store model for Socket.IO. For more details, check out my blog post &lt;a href="http://weblogs.asp.net/shijuvarghese/archive/2013/06/10/scaling-node-js-real-time-apps-with-windows-azure-service-bus.aspx" target="_blank"&gt;Scaling Node.js Real-time Apps with Windows Azure Service Bus&lt;/a&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can follow me on twitter at &lt;/font&gt;&lt;a href="https://twitter.com/shijucv"&gt;&lt;font size="3" face="Calibri"&gt;@shijucv&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;&amp;#160;&lt;/h4&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;</description><pubDate>Thu, 24 Apr 2014 11:59:24 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/pub-sub-in-node-js-apps-using-azure-service-bus-topics</guid><category>Azure</category><category>JavaScript</category><category>Node.js</category></item><item><title>Single Page Application Demo With Hapi.js, AngularJS And Azure Table</title><link>https://weblogs.asp.net:443/shijuvarghese/single-page-application-demo-with-hapi-js-angularjs-and-azure-table</link><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In my previous post &lt;a href="http://weblogs.asp.net/shijuvarghese/archive/2014/04/11/building-an-api-in-node-js-using-hapi-js-and-azure-table.aspx" target="_blank"&gt;Building an API in Node.js Using Hapi.js and Azure Table&lt;/a&gt;, we discussed about building an API in Node.js using Hapi.js as web development framework and Azure Table as the storage mechanism. This app has been updated with a Single Page Application (SPA) client, built with AngularJS. The updated app is available on github at &lt;a title="https://github.com/shijuvar/HapiAzure" href="https://github.com/shijuvar/HapiAzure"&gt;https://github.com/shijuvar/HapiAzure&lt;/a&gt;.&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;About the Demo App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;I have developed this simple app for my personal use for just adding bookmarks with priority range from 1 to 5. I mainly created this for following github repositories with a priority so tat I can look on these bookmarks and evaluate it later based on the priority. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Here’s the technology stack used for the demo app:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt;REST API – Node.js and Hapi.js&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Data Persistence – Microsoft Azure Table&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Web App – AngularJS&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following Node.js modules are using for building the REST API.&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt;hapi – HTTP Server framework, used for building the REST API app.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;azure - Windows Azure Client Library for node, used for persisting data onto Azure Table storage.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;joi - Object schema validation module for Hapi.js.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;node-uuid – Generating unique id for Node.&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Here’s the few screenshots of the app running as a Chrome app&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_54904FAF.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_43C8A501.png" width="749" height="344" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_4A6B88B7.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_756376BC.png" width="749" height="405" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;API Endpoints&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Currently, the API provides the following endpoints:&lt;/font&gt;&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="518" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="157"&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Path&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="76"&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Method&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="283"&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Functionality&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="157"&gt;&lt;font size="3" face="Calibri"&gt;/bookmarks&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="76"&gt;&lt;font size="3" face="Calibri"&gt;Get&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="283"&gt;&lt;font size="3" face="Calibri"&gt;Returns all bookmarks information from the Azure Table storage&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="157"&gt;&lt;font size="3" face="Calibri"&gt;/bookmarks/{rowkey}&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="76"&gt;&lt;font size="3" face="Calibri"&gt;Get&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="283"&gt;&lt;font size="3" face="Calibri"&gt;Get a single bookmark data for the given rowkey of Azure Table&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="157"&gt;&lt;font size="3" face="Calibri"&gt;/bookmarks&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="76"&gt;&lt;font size="3" face="Calibri"&gt;Post&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="283"&gt;&lt;font size="3" face="Calibri"&gt;Create new bookmark item onto Azure Table&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="157"&gt;&lt;font size="3" face="Calibri"&gt;/bookmarks/{rowkey}&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="76"&gt;&lt;font size="3" face="Calibri"&gt;Put&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="283"&gt;&lt;font size="3" face="Calibri"&gt;Update an existing bookmark item&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="157"&gt;&lt;font size="3" face="Calibri"&gt;/bookmarks/{rowkey}&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="76"&gt;&lt;font size="3" face="Calibri"&gt;Delete&lt;/font&gt;&lt;/td&gt;        &lt;td valign="top" width="283"&gt;&lt;font size="3" face="Calibri"&gt;Delete a bookmark item from the Azure Table&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the API project, the API endpoints are defined in the &lt;a href="https://github.com/shijuvar/HapiAzure/blob/master/API/routes/app.js" target="_blank"&gt;app.js&lt;/a&gt; file of routes folder &lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; Joi = require(&lt;span class="str"&gt;&amp;quot;joi&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azure = require(&lt;span class="str"&gt;'azure'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; BookmarkController=require(&lt;span class="str"&gt;'./../controllers/bookmark'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; AzureTable=require(&lt;span class="str"&gt;'./../lib/azuretable'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; nconf = require(&lt;span class="str"&gt;'nconf'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;nconf.env().file({ file: &lt;span class="str"&gt;'config.json'&lt;/span&gt;});&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; tableName = nconf.get(&lt;span class="str"&gt;&amp;quot;TABLE_NAME&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; partitionKey = nconf.get(&lt;span class="str"&gt;&amp;quot;PARTITION_KEY&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; accountName = nconf.get(&lt;span class="str"&gt;&amp;quot;STORAGE_NAME&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; accountKey = nconf.get(&lt;span class="str"&gt;&amp;quot;STORAGE_KEY&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; tableService = azure.createTableService&lt;/pre&gt;

  &lt;pre&gt;                       (accountName, accountKey);&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azureTable = &lt;span class="kwrd"&gt;new&lt;/span&gt; AzureTable(azure.createTableService(&lt;/pre&gt;

  &lt;pre class="alt"&gt;accountName, accountKey), tableName, partitionKey);&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; bookmarkController = &lt;span class="kwrd"&gt;new&lt;/span&gt; BookmarkController(azureTable);&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; routes =&lt;/pre&gt;

  &lt;pre class="alt"&gt;[&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;method: &lt;span class="str"&gt;'GET'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;path: &lt;span class="str"&gt;'/bookmarks'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;config: {&lt;/pre&gt;

  &lt;pre&gt;    handler: bookmarkController.getBookmarks&lt;/pre&gt;

  &lt;pre class="alt"&gt;                             .bind(bookmarkController)&lt;/pre&gt;

  &lt;pre&gt;   }&lt;/pre&gt;

  &lt;pre class="alt"&gt;},&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;method: &lt;span class="str"&gt;'GET'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;path: &lt;span class="str"&gt;'/bookmarks/{rowkey}'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;config: {&lt;/pre&gt;

  &lt;pre&gt;    handler: bookmarkController.getBookmarkById&lt;/pre&gt;

  &lt;pre class="alt"&gt;                             .bind(bookmarkController)&lt;/pre&gt;

  &lt;pre&gt;   }&lt;/pre&gt;

  &lt;pre class="alt"&gt;},&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;method: &lt;span class="str"&gt;'POST'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;path: &lt;span class="str"&gt;'/bookmarks'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;config: {&lt;/pre&gt;

  &lt;pre&gt;   handler: bookmarkController.insertBookmark&lt;/pre&gt;

  &lt;pre class="alt"&gt;                              .bind(bookmarkController),&lt;/pre&gt;

  &lt;pre&gt;   validate: {&lt;/pre&gt;

  &lt;pre class="alt"&gt;       payload: {&lt;/pre&gt;

  &lt;pre&gt;           title: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre class="alt"&gt;           desc: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre&gt;           location: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre class="alt"&gt;           priority: Joi.number().integer().min(1).max(5)&lt;/pre&gt;

  &lt;pre&gt;       } }&lt;/pre&gt;

  &lt;pre class="alt"&gt;  }&lt;/pre&gt;

  &lt;pre&gt;},&lt;/pre&gt;

  &lt;pre class="alt"&gt;{&lt;/pre&gt;

  &lt;pre&gt;method: &lt;span class="str"&gt;'PUT'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;path: &lt;span class="str"&gt;'/bookmarks/{rowkey}'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;config: {&lt;/pre&gt;

  &lt;pre class="alt"&gt;   handler: bookmarkController.updateBookmark&lt;/pre&gt;

  &lt;pre&gt;                       .bind(bookmarkController),&lt;/pre&gt;

  &lt;pre class="alt"&gt;   validate: {&lt;/pre&gt;

  &lt;pre&gt;       payload: {&lt;/pre&gt;

  &lt;pre class="alt"&gt;           title: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre&gt;           desc: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre class="alt"&gt;           location: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre&gt;           priority: Joi.number().integer().min(1).max(5)&lt;/pre&gt;

  &lt;pre class="alt"&gt;       } }&lt;/pre&gt;

  &lt;pre&gt;  }&lt;/pre&gt;

  &lt;pre class="alt"&gt;},&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;method: &lt;span class="str"&gt;'DELETE'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;path: &lt;span class="str"&gt;'/bookmarks/{rowkey}'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;config: {&lt;/pre&gt;

  &lt;pre&gt;   handler: bookmarkController.deleteBookmark&lt;/pre&gt;

  &lt;pre class="alt"&gt;                                .bind(bookmarkController)&lt;/pre&gt;

  &lt;pre&gt;  }&lt;/pre&gt;

  &lt;pre class="alt"&gt;}       &lt;/pre&gt;

  &lt;pre&gt;];&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;module.exports.routes = &lt;span class="kwrd"&gt;function&lt;/span&gt; (server) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    server.route(routes);&lt;/pre&gt;

  &lt;pre&gt;};&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;REST API Mapping with AngularJS&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The AngularJS service $resource is used for interacting with REST API services. The Angular service $resource is designed for working REST endpoints which lets the developers easily consuming RESTful server-side data sources.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;bookmarkApp.factory(&lt;span class="str"&gt;&amp;quot;bookmarkService&amp;quot;&lt;/span&gt;, [&lt;span class="str"&gt;&amp;quot;$resource&amp;quot;&lt;/span&gt;, &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; ($resource) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; baseUri=&lt;span class="str"&gt;'http://localhost:3000/bookmarks/'&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;span class="kwrd"&gt;var&lt;/span&gt; Bookmarks = $resource(baseUri+&lt;span class="str"&gt;':rowkey'&lt;/span&gt;, &lt;/pre&gt;

  &lt;pre&gt;{ rowkey: &lt;span class="str"&gt;'@RowKey'&lt;/span&gt; }, { &lt;span class="str"&gt;'update'&lt;/span&gt;: { method: &lt;span class="str"&gt;'PUT'&lt;/span&gt;} });&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;  &lt;span class="kwrd"&gt;var&lt;/span&gt; getAllBookmarks = &lt;span class="kwrd"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

  &lt;pre class="alt"&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; Bookmarks.query();&lt;/pre&gt;

  &lt;pre&gt;   };&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; addNewBookmark = &lt;span class="kwrd"&gt;function&lt;/span&gt; (newBookmark) {&lt;/pre&gt;

  &lt;pre&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; Bookmarks.save(newBookmark);&lt;/pre&gt;

  &lt;pre class="alt"&gt;    };&lt;/pre&gt;

  &lt;pre&gt;   &lt;span class="kwrd"&gt;var&lt;/span&gt; updateBookmark = &lt;span class="kwrd"&gt;function&lt;/span&gt; (bookmark) {     &lt;/pre&gt;

  &lt;pre class="alt"&gt;         &lt;span class="kwrd"&gt;return&lt;/span&gt; Bookmarks.update(bookmark);     &lt;/pre&gt;

  &lt;pre&gt;   };&lt;/pre&gt;

  &lt;pre class="alt"&gt;   &lt;span class="kwrd"&gt;var&lt;/span&gt; getBookmarkByRowKey = &lt;span class="kwrd"&gt;function&lt;/span&gt; (rowKey) {&lt;/pre&gt;

  &lt;pre&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; Bookmarks.get({rowkey:rowKey});&lt;/pre&gt;

  &lt;pre class="alt"&gt;    };&lt;/pre&gt;

  &lt;pre&gt;   &lt;span class="kwrd"&gt;var&lt;/span&gt; deleteBookmark = &lt;span class="kwrd"&gt;function&lt;/span&gt; (rowKey) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;     &lt;span class="kwrd"&gt;return&lt;/span&gt; Bookmarks.delete({rowkey:rowKey});&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;   };&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; {&lt;/pre&gt;

  &lt;pre class="alt"&gt;      getAll: getAllBookmarks,&lt;/pre&gt;

  &lt;pre&gt;       addNew: addNewBookmark,&lt;/pre&gt;

  &lt;pre class="alt"&gt;       update: updateBookmark,&lt;/pre&gt;

  &lt;pre&gt;      getByKey: getBookmarkByRowKey,&lt;/pre&gt;

  &lt;pre class="alt"&gt;       remove: deleteBookmark&lt;/pre&gt;

  &lt;pre&gt;  };&lt;/pre&gt;

  &lt;pre class="alt"&gt;} ]);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Data Persistence with Microsoft Azure Table Storage&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The Node.js module &lt;a href="https://www.npmjs.org/package/azure" target="_blank"&gt;azure&lt;/a&gt; uses for working Azure Table storage. The code block below provides the implementations of CRUD operations against the Azure Table storage. &lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="str"&gt;&amp;quot;use strict&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azure = require(&lt;span class="str"&gt;'azure'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; uuid = require(&lt;span class="str"&gt;'node-uuid'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;module.exports = AzureTable;&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; AzureTable(storageClient, tableName, partitionKey) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.storageClient = storageClient;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.tableName = tableName;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.partitionKey = partitionKey;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.storageClient.createTableIfNotExists(tableName,&lt;/pre&gt;

  &lt;pre class="alt"&gt;   &lt;span class="kwrd"&gt;function&lt;/span&gt; tableCreated(error) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt;(error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;throw&lt;/span&gt; error;&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    });&lt;/pre&gt;

  &lt;pre&gt;};&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;AzureTable.prototype = {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    find: &lt;span class="kwrd"&gt;function&lt;/span&gt; (query, callback) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        self.storageClient.queryEntities(query, &lt;/pre&gt;

  &lt;pre&gt;       &lt;span class="kwrd"&gt;function&lt;/span&gt; entitiesQueried(error, entities) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre&gt;                callback(error);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            } &lt;span class="kwrd"&gt;else&lt;/span&gt; {&lt;/pre&gt;

  &lt;pre&gt;                callback(&lt;span class="kwrd"&gt;null&lt;/span&gt;, entities);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            }&lt;/pre&gt;

  &lt;pre&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;    },&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;    addItem: &lt;span class="kwrd"&gt;function&lt;/span&gt; (item, callback) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        item.RowKey = uuid();&lt;/pre&gt;

  &lt;pre&gt;        item.PartitionKey = self.partitionKey;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        self.storageClient.insertEntity(self.tableName, item,&lt;/pre&gt;

  &lt;pre&gt;       &lt;span class="kwrd"&gt;function&lt;/span&gt; entityInserted(error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre&gt;                callback(error);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            }&lt;/pre&gt;

  &lt;pre&gt;            callback(&lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;        });&lt;/pre&gt;

  &lt;pre&gt;    },&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;    updateItem: &lt;span class="kwrd"&gt;function&lt;/span&gt; (item, callback) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;        self.storageClient.updateEntity(self.tableName, item, &lt;/pre&gt;

  &lt;pre class="alt"&gt;       &lt;span class="kwrd"&gt;function&lt;/span&gt; entityUpdated(error) {&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                callback(error);&lt;/pre&gt;

  &lt;pre&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;            callback(&lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;    },&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;    deleteItem: &lt;span class="kwrd"&gt;function&lt;/span&gt; (rowKey, callback) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        self.storageClient.deleteEntity(self.tableName&lt;/pre&gt;

  &lt;pre&gt;            , {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                PartitionKey : self.partitionKey&lt;/pre&gt;

  &lt;pre&gt;                , RowKey : rowKey&lt;/pre&gt;

  &lt;pre class="alt"&gt;            }&lt;/pre&gt;

  &lt;pre&gt;            ,&lt;span class="kwrd"&gt;function&lt;/span&gt; entityDeleted(error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre&gt;                    callback(error);&lt;/pre&gt;

  &lt;pre class="alt"&gt;                }&lt;/pre&gt;

  &lt;pre&gt;                callback(&lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            });&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Source Code&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The demo app is available at &lt;a title="https://github.com/shijuvar/HapiAzure" href="https://github.com/shijuvar/HapiAzure"&gt;https://github.com/shijuvar/HapiAzure&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Creating Free Trial Account in Microsoft Azure&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;This demo app uses Microsoft Azure Storage which need a subscription in Azure. You will get free one month trial account in Azure which also provides free $200 credits to spending on all Azure services. You will get the free trial account from &lt;a href="http://azure.microsoft.com/en-us/pricing/free-trial/" target="_blank"&gt;here&lt;/a&gt;. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can follow me on Twitter &lt;/font&gt;&lt;a href="https://twitter.com/shijucv"&gt;&lt;font size="3" face="Calibri"&gt;@shijucv&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;</description><pubDate>Wed, 23 Apr 2014 09:15:55 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/single-page-application-demo-with-hapi-js-angularjs-and-azure-table</guid><category>AngularJS</category><category>Azure</category><category>JavaScript</category><category>Node.js</category></item><item><title>Building Distributed Node.js Apps with Azure Service Bus Queue</title><link>https://weblogs.asp.net:443/shijuvarghese/building-distributed-node-js-apps-with-azure-service-bus-queue</link><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In this blog post, I will take a look at Azure Service Bus Queue for building distributed apps in Node.js. Azure Service Bus Queues provides, a queue based, brokered messaging communication between apps, which lets developers build distributed apps on the Cloud and also for hybrid Cloud environments. Azure Service Bus Queue provides First In, First Out (FIFO) messaging infrastructure. Service Bus Queues can be leveraged for communicating between apps, whether the apps are hosted on the cloud or on-premises servers. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Service Bus Queues are primarily used for distributing application logic into multiple apps. For an example, let’s say, we are building an order processing app where we are building a frontend web app for receiving orders from customers and want to move order processing logic into a backend service where we can implement the order processing logic in an asynchronous manner. In this sample scenario, we can use Azure Service Bus Queue, where we can create an order processing message into Service Bus Queue from frontend app for processing the request. From the backend order processing app, we can receives the message from Queue and can process the request in an efficient manner. This approach also enables better scalability as we can separately scale-up frontend app and backend app. For this sample scenario, we can deploy the frontend app onto Azure Web Role and backend app onto Azure Worker Role and can separately&amp;#160; scale-up both Web Role and Worker Role apps. We can also use &lt;font size="3" face="Calibri"&gt;Service Bus Queues for hybrid Cloud scenarios where we can communicate between apps hosted on Cloud and On-premises servers.&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;&lt;strong&gt;&lt;font size="4"&gt;Using Azure &lt;font face="Calibri"&gt;Service Bus Queues in Node.js Apps&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In order to working with Azure Service Bus, we need to create a Service Bus namespace from &lt;a href="https://portal.azure.com" target="_blank"&gt;Azure portal&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_2406980B.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_2F32B306.png" width="482" height="367" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;We can take the connection information of Service Bus namespace from the Connection Information tab in the bottom section, after choosing the Service Bus namespace.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_3C2F23C8.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_302D3394.png" width="235" height="63" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Creating the Service Bus Client&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Firstly, we need to install npm module azure to working with Azure services from Node.js app.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font style="style" size="3" face="Calibri"&gt;&lt;em&gt;npm install azure&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;      &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below creates a Service Bus client object using the Node.js module azure.&lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azure = require(&lt;span class="str"&gt;'azure'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; config=require(&lt;span class="str"&gt;'./config'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; serviceBusClient = azure.createServiceBusService(config.sbConnection);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;We create the Service Bus client object by using createServiceBusService method of azure. In the above code block, we pass the Service Bus connection info from a config file. The azure module can also read the environment variables AZURE_SERVICEBUS_NAMESPACE and AZURE_SERVICEBUS_ACCESS_KEY for information required to connect with Azure Service Bus where we can call&amp;#160; createServiceBusService method without specifying the connection information.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Creating a Services Bus Queue&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The createQueueIfNotExists method of Service Bus client object, returns the queue if it is already exists, or create a new Queue if it is not exists.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azure = require(&lt;span class="str"&gt;'azure'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; config=require(&lt;span class="str"&gt;'./config'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; queue = &lt;span class="str"&gt;'ordersqueue'&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; serviceBusClient = azure.createServiceBusService(config.sbConnection);&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; createQueue() {  &lt;/pre&gt;

  &lt;pre&gt; serviceBusClient.createQueueIfNotExists(queue, &lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;span class="kwrd"&gt;function&lt;/span&gt;(error){&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt;(error){&lt;/pre&gt;

  &lt;pre class="alt"&gt;        console.log(error);&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        console.log(&lt;span class="str"&gt;'Queue '&lt;/span&gt; + queue+ &lt;span class="str"&gt;' exists'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;});&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Sending Messages to Services Bus Queue&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The below function sendMessage sends a given message to Service Bus Queue &lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; sendMessage(message) {&lt;/pre&gt;

  &lt;pre&gt;    serviceBusClient.sendQueueMessage(queue,message,&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;span class="kwrd"&gt;function&lt;/span&gt;(error) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            console.log(error);&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            console.log(&lt;span class="str"&gt;'Message sent to queue'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    });&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following code create the queue and sending a message to Queue by calling the methods createQueue and sendMessage which we have created in the previous steps.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;createQueue();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; orderMessage={&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;span class="str"&gt;&amp;quot;OrderId&amp;quot;&lt;/span&gt;:101,&lt;/pre&gt;

  &lt;pre&gt; &lt;span class="str"&gt;&amp;quot;OrderDate&amp;quot;&lt;/span&gt;: &lt;span class="kwrd"&gt;new&lt;/span&gt; Date().toDateString()&lt;/pre&gt;

  &lt;pre class="alt"&gt;};&lt;/pre&gt;

  &lt;pre&gt;sendMessage(JSON.stringify(orderMessage));&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;We create a JSON object with properties OrderId and OrderDate and send this to the Service Bus Queue. We can send these messages to Queue for communicating with other apps where the receiver apps can read the messages from Queue and perform the application logic based on the messages we have provided.&lt;/font&gt;&lt;/p&gt;







&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Receiving Messages from Services Bus Queue&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Typically, we will be receive the Service Bus Queue messages from a backend app. The code block below receives the messages from Service Bus Queue and extracting information from the JSON data. &lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azure = require(&lt;span class="str"&gt;'azure'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; config=require(&lt;span class="str"&gt;'./config'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; queue = &lt;span class="str"&gt;'ordersqueue'&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; serviceBusClient = azure.createServiceBusService(config.sbConnection);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; receiveMessages() {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    serviceBusClient.receiveQueueMessage(queue, &lt;/pre&gt;

  &lt;pre&gt;      &lt;span class="kwrd"&gt;function&lt;/span&gt; (error, message) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre&gt;            console.log(error);&lt;/pre&gt;

  &lt;pre class="alt"&gt;        } &lt;span class="kwrd"&gt;else&lt;/span&gt; {&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; message = JSON.parse(message.body);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            console.log(&lt;span class="str"&gt;'Processing Order# '&lt;/span&gt; + message.OrderId&lt;/pre&gt;

  &lt;pre&gt;                + &lt;span class="str"&gt;' placed on '&lt;/span&gt; + message.OrderDate);&lt;/pre&gt;

  &lt;pre class="alt"&gt;        }&lt;/pre&gt;

  &lt;pre&gt;    });&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;By default, the messages will be deleted from Service Bus Queue after reading the messages. This behaviour can be changed by specifying the optional parameter isPeekLock as true as sown in the below code block.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; receiveMessages() {&lt;/pre&gt;

  &lt;pre&gt;    serviceBusClient.receiveQueueMessage(queue,{ isPeekLock: &lt;span class="kwrd"&gt;true&lt;/span&gt; }, &lt;/pre&gt;

  &lt;pre class="alt"&gt;      &lt;span class="kwrd"&gt;function&lt;/span&gt; (error, message) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            console.log(error);&lt;/pre&gt;

  &lt;pre&gt;        } &lt;span class="kwrd"&gt;else&lt;/span&gt; {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; message = JSON.parse(message.body);&lt;/pre&gt;

  &lt;pre&gt;          console.log(&lt;span class="str"&gt;'Processing Order# '&lt;/span&gt; + message.OrderId&lt;/pre&gt;

  &lt;pre class="alt"&gt;                + &lt;span class="str"&gt;' placed on '&lt;/span&gt; + message.OrderDate);&lt;/pre&gt;

  &lt;pre&gt;          serviceBusService.deleteMessage(message,&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;function&lt;/span&gt; (deleteError){&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt;(!deleteError){&lt;/pre&gt;

  &lt;pre class="alt"&gt;                console.delete(&lt;span class="str"&gt;'Message deleted from Queue'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;             }&lt;/pre&gt;

  &lt;pre class="alt"&gt;           }&lt;/pre&gt;

  &lt;pre&gt;          });&lt;/pre&gt;

  &lt;pre class="alt"&gt;        }&lt;/pre&gt;

  &lt;pre&gt;    });&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Here the message will not be automatically deleted from Queue and we can explicitly delete the messages from Queue after reading and successfully implementing the application logic. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can follow me on Twitter &lt;/font&gt;&lt;a href="https://twitter.com/shijucv"&gt;&lt;font size="3" face="Calibri"&gt;@shijucv&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;</description><pubDate>Mon, 14 Apr 2014 15:46:20 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/building-distributed-node-js-apps-with-azure-service-bus-queue</guid><category>Azure</category><category>JavaScript</category><category>Node.js</category></item><item><title>Building an API in Node.js Using Hapi.js and Azure Table</title><link>https://weblogs.asp.net:443/shijuvarghese/building-an-api-in-node-js-using-hapi-js-and-azure-table</link><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In this post, I will demonstrate a sample REST API app in a Node.js, by using Hapi.js as the web application framework and Azure Table as the storage. The source code of the demo app available on github at &lt;a title="https://github.com/shijuvar/HapiAzure" href="https://github.com/shijuvar/HapiAzure"&gt;https://github.com/shijuvar/HapiAzure&lt;/a&gt;. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following npm modules are using for this simple REST API.&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt;hapi – HTTP Server framework, used for building the REST API app.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;azure - Windows Azure Client Library for node, used for persisting data&amp;#160; onto Azure Table storage.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;joi - Object schema validation module for Hapi.js.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;node-uuid – Generating unique id for Node.&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Azure Table Storage&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;a href="http://azure.microsoft.com/en-us/services/storage/" target="_blank"&gt;Azure table storage&lt;/a&gt;, stores structured data on the Microsoft Azure cloud platform. Azure Table storage is a NoSQL kind of data store, which provides massive scalability with the ability of storing terabytes of structured data. Azure Table entity has three systems properties: RowKey for Id of the Table, PartitionKey for partitioning the Table storage and Timestamp for date information.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Hapi.js&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;a href="https://github.com/spumko/hapi" target="_blank"&gt;Hapi.js&lt;/a&gt; is a rich web development framework for building web applications and services. Hapi is configuration-centric framework which provides validation, caching, authentication, and also supports a plugin architecture for building scalable systems. &lt;font size="3" face="Calibri"&gt;Hapi is built by WalmartLabs to power their mobile backend services.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Building the Demo App&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s build our sample REST API demo with Hapi and Azure Table. In this demo, we are using a Azure Table named bookmarks. For the sake of the demo, we are simply using a Partition Key mybookmarks. Let’s create a config.json file for storing configurations of Azure Table storage.&lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;{&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="str"&gt;&amp;quot;STORAGE_NAME&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;Your-Storage-Name&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="str"&gt;&amp;quot;STORAGE_KEY&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;Your-Storage-Key&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="str"&gt;&amp;quot;PARTITION_KEY&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;myBookmarks&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="str"&gt;&amp;quot;TABLE_NAME&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;bookmarks&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;A Helper for Azure Table&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s build a helper object for working with Azure Table in the Node.js app. Let’s create azuretable.js into the app folder lib.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azure = require(&lt;span class="str"&gt;'azure'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; AzureTable(storageClient, tableName, partitionKey) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.storageClient = storageClient;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.tableName = tableName;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.partitionKey = partitionKey;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.storageClient.createTableIfNotExists(tableName, &lt;/pre&gt;

  &lt;pre class="alt"&gt;       &lt;span class="kwrd"&gt;function&lt;/span&gt; tableCreated(error) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt;(error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;throw&lt;/span&gt; error;&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    });&lt;/pre&gt;

  &lt;pre&gt;};&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the above code block, we are using Node.js module azure for working with Azure Table. In the constructor function, we cerate properties for storing Azure storage client object, table name and partition key. We are also create the Azure Table within the constructor function. The property storageClient&amp;#160; represents the Azure storage client object which can be used for working with a Azure Table storage. The complete implementation of the azuretable.js for Create, Read, Update and Delete operations with Table storage, is provided below:&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="str"&gt;&amp;quot;use strict&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azure = require(&lt;span class="str"&gt;'azure'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; uuid = require(&lt;span class="str"&gt;'node-uuid'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;module.exports = AzureTable;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; AzureTable(storageClient, tableName, partitionKey) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.storageClient = storageClient;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.tableName = tableName;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.partitionKey = partitionKey;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.storageClient.createTableIfNotExists(tableName,&lt;/pre&gt;

  &lt;pre class="alt"&gt;   &lt;span class="kwrd"&gt;function&lt;/span&gt; tableCreated(error) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt;(error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;throw&lt;/span&gt; error;&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    });&lt;/pre&gt;

  &lt;pre&gt;};&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;AzureTable.prototype = {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    find: &lt;span class="kwrd"&gt;function&lt;/span&gt; (query, callback) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        self.storageClient.queryEntities(query, &lt;/pre&gt;

  &lt;pre&gt;       &lt;span class="kwrd"&gt;function&lt;/span&gt; entitiesQueried(error, entities) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre&gt;                callback(error);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            } &lt;span class="kwrd"&gt;else&lt;/span&gt; {&lt;/pre&gt;

  &lt;pre&gt;                callback(&lt;span class="kwrd"&gt;null&lt;/span&gt;, entities);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            }&lt;/pre&gt;

  &lt;pre&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;    },&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    addItem: &lt;span class="kwrd"&gt;function&lt;/span&gt; (item, callback) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        item.RowKey = uuid();&lt;/pre&gt;

  &lt;pre&gt;        item.PartitionKey = self.partitionKey;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        self.storageClient.insertEntity(self.tableName, item,&lt;/pre&gt;

  &lt;pre&gt;       &lt;span class="kwrd"&gt;function&lt;/span&gt; entityInserted(error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre&gt;                callback(error);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            }&lt;/pre&gt;

  &lt;pre&gt;            callback(&lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;        });&lt;/pre&gt;

  &lt;pre&gt;    },&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;    updateItem: &lt;span class="kwrd"&gt;function&lt;/span&gt; (item, callback) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;        self.storageClient.updateEntity(self.tableName, item, &lt;/pre&gt;

  &lt;pre class="alt"&gt;       &lt;span class="kwrd"&gt;function&lt;/span&gt; entityUpdated(error) {&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                callback(error);&lt;/pre&gt;

  &lt;pre&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;            callback(&lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;    },&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    deleteItem: &lt;span class="kwrd"&gt;function&lt;/span&gt; (rowKey, callback) {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        self.storageClient.deleteEntity(self.tableName&lt;/pre&gt;

  &lt;pre&gt;            , {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                PartitionKey : self.partitionKey&lt;/pre&gt;

  &lt;pre&gt;                , RowKey : rowKey&lt;/pre&gt;

  &lt;pre class="alt"&gt;            }&lt;/pre&gt;

  &lt;pre&gt;            ,&lt;span class="kwrd"&gt;function&lt;/span&gt; entityDeleted(error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (error) {&lt;/pre&gt;

  &lt;pre&gt;                    callback(error);&lt;/pre&gt;

  &lt;pre class="alt"&gt;                }&lt;/pre&gt;

  &lt;pre&gt;                callback(&lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;            });&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Controller for handling CRUD operations&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;We have created a helper object for working with Azure Table storage. Let’s create a controller for responding to routes of the Hapi.js app. Let’s create the file bookmark.js into the folder controllers.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="str"&gt;&amp;quot;use strict&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azure = require(&lt;span class="str"&gt;'azure'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;module.exports = BookmarkController;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; BookmarkController(azureTable) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.azureTable = azureTable;&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;BookmarkController.prototype = {&lt;/pre&gt;

  &lt;pre&gt;    getBookmarks: &lt;span class="kwrd"&gt;function&lt;/span&gt; (request, reply) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; query = azure.TableQuery&lt;/pre&gt;

  &lt;pre class="alt"&gt;            .select()&lt;/pre&gt;

  &lt;pre&gt;            .from(self.azureTable.tableName)&lt;/pre&gt;

  &lt;pre class="alt"&gt;            .where(&lt;span class="str"&gt;'PartitionKey eq ?'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;                 self.azureTable.partitionKey);&lt;/pre&gt;

  &lt;pre class="alt"&gt;        self.azureTable.find(query,&lt;/pre&gt;

  &lt;pre&gt;     &lt;span class="kwrd"&gt;function&lt;/span&gt; itemsFound(error, items) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;           reply(items);&lt;/pre&gt;

  &lt;pre&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;    },&lt;/pre&gt;

  &lt;pre&gt;    insertBookmark: &lt;span class="kwrd"&gt;function&lt;/span&gt; insertBookmark(request, reply) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; bookmark = {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            title : request.payload.title&lt;/pre&gt;

  &lt;pre&gt;            , desc :  request.payload.desc&lt;/pre&gt;

  &lt;pre class="alt"&gt;            , location: request.payload.location&lt;/pre&gt;

  &lt;pre&gt;            , priority: request.payload.priority&lt;/pre&gt;

  &lt;pre class="alt"&gt;        };&lt;/pre&gt;

  &lt;pre&gt;        self.azureTable.addItem(bookmark, &lt;/pre&gt;

  &lt;pre class="alt"&gt;       &lt;span class="kwrd"&gt;function&lt;/span&gt; itemAdded(error) {&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt;(error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                reply(error);&lt;/pre&gt;

  &lt;pre&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt;{ reply(bookmark);}&lt;/pre&gt;

  &lt;pre&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;    },&lt;/pre&gt;

  &lt;pre&gt;    updateBookmark: &lt;span class="kwrd"&gt;function&lt;/span&gt; updateBookmark(request, reply) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; bookmark = {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            PartitionKey : self.azureTable.partitionKey&lt;/pre&gt;

  &lt;pre&gt;            , RowKey : request.&lt;span class="kwrd"&gt;params&lt;/span&gt;.rowkey&lt;/pre&gt;

  &lt;pre class="alt"&gt;            , title : request.payload.title&lt;/pre&gt;

  &lt;pre&gt;            , desc :  request.payload.desc&lt;/pre&gt;

  &lt;pre class="alt"&gt;            , location: request.payload.location&lt;/pre&gt;

  &lt;pre&gt;            , priority: request.payload.priority&lt;/pre&gt;

  &lt;pre class="alt"&gt;        };&lt;/pre&gt;

  &lt;pre&gt;        self.azureTable.updateItem(bookmark, &lt;/pre&gt;

  &lt;pre class="alt"&gt;      &lt;span class="kwrd"&gt;function&lt;/span&gt; itemUpdated(error) {&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt;(error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                reply(error);&lt;/pre&gt;

  &lt;pre&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt;{ reply(bookmark);}&lt;/pre&gt;

  &lt;pre&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;    },&lt;/pre&gt;

  &lt;pre&gt;    deleteBookmark: &lt;span class="kwrd"&gt;function&lt;/span&gt; deleteBookmark(request, reply) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; self = &lt;span class="kwrd"&gt;this&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;        self.azureTable.deleteItem(request.&lt;span class="kwrd"&gt;params&lt;/span&gt;.rowkey, &lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;function&lt;/span&gt; itemDeleted(error) {&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt;(error) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                reply(error);&lt;/pre&gt;

  &lt;pre&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt;{reply({ message : &lt;span class="str"&gt;&amp;quot;Item deleted&amp;quot;&lt;/span&gt;})}&lt;/pre&gt;

  &lt;pre&gt;        });&lt;/pre&gt;

  &lt;pre class="alt"&gt;    }&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the above code block, we are taking incoming form field values and simply calling the methods provided by AzureTable object. In the constructor function, we specify a property azureTable for refering the AzureTable object.&amp;#160; &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Specifying the routes of the app with Hapi.js&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The routing mechanism provided by Hapi, is brilliant than any other Node.js web development framework. Hapi provides object schema validation by using Node.js module &lt;a href="https://www.npmjs.org/package/joi" target="_blank"&gt;Joi&lt;/a&gt;. Let’s create a app.js file for specifying the routes with validations provided by Joi module.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; Joi = require(&lt;span class="str"&gt;&amp;quot;joi&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azure = require(&lt;span class="str"&gt;'azure'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; BookmarkController=require(&lt;span class="str"&gt;'./../controllers/bookmark'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; AzureTable=require(&lt;span class="str"&gt;'./../lib/azuretable'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; nconf = require(&lt;span class="str"&gt;'nconf'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;nconf.env().file({ file: &lt;span class="str"&gt;'config.json'&lt;/span&gt;});&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; tableName = nconf.get(&lt;span class="str"&gt;&amp;quot;TABLE_NAME&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; partitionKey = nconf.get(&lt;span class="str"&gt;&amp;quot;PARTITION_KEY&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; accountName = nconf.get(&lt;span class="str"&gt;&amp;quot;STORAGE_NAME&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; accountKey = nconf.get(&lt;span class="str"&gt;&amp;quot;STORAGE_KEY&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; tableService = azure.createTableService&lt;/pre&gt;

  &lt;pre&gt;                       (accountName, accountKey);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; azureTable = &lt;span class="kwrd"&gt;new&lt;/span&gt; AzureTable(azure.createTableService(&lt;/pre&gt;

  &lt;pre class="alt"&gt;accountName, accountKey), tableName, partitionKey);&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; bookmarkController = &lt;span class="kwrd"&gt;new&lt;/span&gt; BookmarkController(azureTable);&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; routes =&lt;/pre&gt;

  &lt;pre class="alt"&gt;[&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;method: &lt;span class="str"&gt;'GET'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;path: &lt;span class="str"&gt;'/bookmarks'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;config: {&lt;/pre&gt;

  &lt;pre&gt;    handler: bookmarkController.getBookmarks&lt;/pre&gt;

  &lt;pre class="alt"&gt;                             .bind(bookmarkController)&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;},&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;method: &lt;span class="str"&gt;'POST'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;path: &lt;span class="str"&gt;'/bookmarks'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;config: {&lt;/pre&gt;

  &lt;pre&gt;   handler: bookmarkController.insertBookmark&lt;/pre&gt;

  &lt;pre class="alt"&gt;                              .bind(bookmarkController),&lt;/pre&gt;

  &lt;pre&gt;   validate: {&lt;/pre&gt;

  &lt;pre class="alt"&gt;       payload: {&lt;/pre&gt;

  &lt;pre&gt;           title: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre class="alt"&gt;           desc: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre&gt;           location: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre class="alt"&gt;           priority: Joi.number().integer().min(1).max(5)&lt;/pre&gt;

  &lt;pre&gt;       } }&lt;/pre&gt;

  &lt;pre class="alt"&gt;  }&lt;/pre&gt;

  &lt;pre&gt;},&lt;/pre&gt;

  &lt;pre class="alt"&gt;{&lt;/pre&gt;

  &lt;pre&gt;method: &lt;span class="str"&gt;'PUT'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;path: &lt;span class="str"&gt;'/bookmarks/{rowkey}'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;config: {&lt;/pre&gt;

  &lt;pre class="alt"&gt;   handler: bookmarkController.updateBookmark&lt;/pre&gt;

  &lt;pre&gt;                       .bind(bookmarkController),&lt;/pre&gt;

  &lt;pre class="alt"&gt;   validate: {&lt;/pre&gt;

  &lt;pre&gt;       payload: {&lt;/pre&gt;

  &lt;pre class="alt"&gt;           title: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre&gt;           desc: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre class="alt"&gt;           location: Joi.&lt;span class="kwrd"&gt;string&lt;/span&gt;(),&lt;/pre&gt;

  &lt;pre&gt;           priority: Joi.number().integer().min(1).max(5)&lt;/pre&gt;

  &lt;pre class="alt"&gt;       } }&lt;/pre&gt;

  &lt;pre&gt;  }&lt;/pre&gt;

  &lt;pre class="alt"&gt;},&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;method: &lt;span class="str"&gt;'DELETE'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;path: &lt;span class="str"&gt;'/bookmarks/{rowkey}'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;config: {&lt;/pre&gt;

  &lt;pre&gt;   handler: bookmarkController.deleteBookmark&lt;/pre&gt;

  &lt;pre class="alt"&gt;                                .bind(bookmarkController)&lt;/pre&gt;

  &lt;pre&gt;  }&lt;/pre&gt;

  &lt;pre class="alt"&gt;}       &lt;/pre&gt;

  &lt;pre&gt;];&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;module.exports.routes = &lt;span class="kwrd"&gt;function&lt;/span&gt; (server) {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    server.route(routes);&lt;/pre&gt;

  &lt;pre&gt;};&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The beauty of Hapi.js is that you can specify validation for the schema of form payload, query variable and route path. Here we create the BookmarkController object and assign its methods as handler functions of routes in the Hapi http server. The azure module’s createTableService method creates a Table storage client which passes to the constructor function of AzureTable object along with Table Name and Partition Key. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s create the http server with Hapi&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; Hapi = require(&lt;span class="str"&gt;'hapi'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; app = require(&lt;span class="str"&gt;'./routes/app'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; port = process.env.PORT || 3000;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; host = process.env.HOST || &lt;span class="str"&gt;'localhost'&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; server = &lt;span class="kwrd"&gt;new&lt;/span&gt; Hapi.Server(host,port,{ cors: &lt;span class="kwrd"&gt;true&lt;/span&gt; });&lt;/pre&gt;

  &lt;pre class="alt"&gt;app.routes(server);&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;server.start(&lt;span class="kwrd"&gt;function&lt;/span&gt;() {&lt;/pre&gt;

  &lt;pre&gt;    console.log(&lt;span class="str"&gt;&amp;quot;Hapi server started @ &amp;quot;&lt;/span&gt; + server.info.uri);&lt;/pre&gt;

  &lt;pre class="alt"&gt;});&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Source Code of the demo app&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block structure of the app is provided below:&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_4E082077.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_484D06D1.png" width="244" height="225" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can download the source code from &lt;a title="https://github.com/shijuvar/HapiAzure" href="https://github.com/shijuvar/HapiAzure"&gt;https://github.com/shijuvar/HapiAzure&lt;/a&gt;. &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can follow me on Twitter &lt;/font&gt;&lt;a href="https://twitter.com/shijucv"&gt;&lt;font size="3" face="Calibri"&gt;@shijucv&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;</description><pubDate>Fri, 11 Apr 2014 06:45:31 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/building-an-api-in-node-js-using-hapi-js-and-azure-table</guid><category>Azure</category><category>JavaScript</category><category>Node.js</category></item><item><title>Microsoft Azure Mobile Services Managed Client SDK with Offline Support</title><link>https://weblogs.asp.net:443/shijuvarghese/microsoft-azure-mobile-services-managed-client-sdk-with-offline-support</link><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In this post, I will take a look at the new offline support provided by Microsoft Azure Mobile Services to the managed client SDK v1.3 alpha, which can be used for building Windows store apps with offline capabilities and syncing data between local database and Azure Mobile Service database. Microsoft Azure Mobile Services has been evolving over time with new useful features. On the last update, Azure Mobile Services started to support .NET for writing backend so that developers can now write backend logic either in C# or in JavaScript/Node.js. The latest addition to the evolving Microsoft Azure Mobile Services is the support for working with offline scenarios, which is an excellent feature, while we are building mobile apps. This lets the mobile apps to store data on the local storage in offline scenario and can sync-up the data to the Mobile Services storage when we are connected to the internet. The current version is a preview version available for managed clients. SQLite is used for persisting the &lt;/font&gt;&lt;font size="3" face="Calibri"&gt;offline data on the client apps.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;&lt;font size="4"&gt;Setting up the Mobile Services client with offline data persistence&lt;/font&gt;&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following steps demonstrate how to set up a Windows Store client app for working with &lt;font size="3" face="Calibri"&gt;offline &lt;/font&gt;storage on SQLite and sync offline data with Azure Mobile Services data.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Step 1 – Install SQLite for Windows 8.1&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="3" face="Calibri"&gt;SQLite is used for persisting the data in the offline scenario so download and install SQLite for Windows 8.1 from &lt;a href="http://go.microsoft.com/fwlink/?linkid=394776&amp;amp;clcid=0x409" target="_blank"&gt;here&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Step 2 – Add reference to SQLite for Windows Runtime (Windows 8.1)&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In your Windows Store app, add a reference to SQLite for Windows Runtime (Windows 8.1) from Add Reference, Reference Manager, choose Extensions from Windows as shown in the below figure.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_1B41F84F.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_1AD8560B.png" width="591" height="196"&gt;&lt;/a&gt;&lt;/p&gt;   &lt;p&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;&lt;strong&gt;Step 3 – Add NuGet package WindowsAzure.MobileServices.SQLiteStore&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Add NuGet package &lt;a href="http://www.nuget.org/packages/WindowsAzure.MobileServices.SQLiteStore/" target="_blank"&gt;WindowsAzure.MobileServices.SQLiteStore&lt;/a&gt; in order to working with SQLite store in the offline scenario. Please keep in mind that you should select “Include Prerelease” to get the alpha version of the package.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_5DD945DA.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_5B331ADA.png" width="569" height="116"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Step 4 – Define Data Models with system property Version&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="3" face="Calibri"&gt;In order to working with data syncing scenarios, data models should include a system property &lt;strong&gt;Version&lt;/strong&gt;. You can decorate a version property with MobileServices.VersionAttribute.&amp;nbsp; &lt;/font&gt;&lt;/p&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; TodoItem&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Id { get; set; }&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;        [JsonProperty(PropertyName = &lt;span class="str"&gt;"text"&lt;/span&gt;)]&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Text { get; set; }&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;        [JsonProperty(PropertyName = &lt;span class="str"&gt;"complete"&lt;/span&gt;)]&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; Complete { get; set; }&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;        [Version]&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Version { get; set; }&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;/p&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Step 5 – Declare a IMobileServicesSyncTable Table for data sync&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Define the IMobileServicesSyncTable table object to working with a model entity for data sync scenarios.&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;//using statement for IMobileServiceSyncTable&amp;lt;T&amp;gt; &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.WindowsAzure.MobileServices.Sync;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt; &lt;span class="kwrd"&gt;private&lt;/span&gt; IMobileServiceSyncTable&amp;lt;TodoItem&amp;gt; todoTable = App.MobileService.GetSyncTable&amp;lt;TodoItem&amp;gt;();&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Step 6 – Initializes the client sync context with a SQLite store&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Initialize the client sync context object with a SQLite data store.&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;//Using statement for SQLiteStore&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.WindowsAzure.MobileServices.SQLiteStore;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (!App.MobileService.SyncContext.IsInitialized)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    var store = &lt;span class="kwrd"&gt;new&lt;/span&gt; MobileServiceSQLiteStore(&lt;span class="str"&gt;"localsync12.db"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;    store.DefineTable&amp;lt;TodoItem&amp;gt;();&lt;/pre&gt;&lt;pre class="alt"&gt;    await App.MobileService.SyncContext.InitializeAsync(store, &lt;span class="kwrd"&gt;new&lt;/span&gt; MobileServiceSyncHandler());&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;






&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the above code block, MobileService object is the Mobile Services client of your Windows Store App.&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; MobileServiceClient MobileService =&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;new&lt;/span&gt; MobileServiceClient(&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="str"&gt;"https://shijuvar-zumo.azure-mobile.net/"&lt;/span&gt;,&lt;/pre&gt;&lt;pre&gt;    &lt;span class="str"&gt;"your-application-key"&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;);&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Data sync between offline storage and Mobile Services Data&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the above steps, we have configured our Windows store app for working with offline storage in a SQLite database. The information below provides how to insert data into offline storage and sync the data between offline and Azure Mobil Services storage.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Insert data to offline storage&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below inserts a new&amp;nbsp; data to the database&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; async &lt;span class="kwrd"&gt;void&lt;/span&gt; InsertTodoItem(TodoItem todoItem)&lt;/pre&gt;&lt;pre&gt;{            &lt;/pre&gt;&lt;pre class="alt"&gt;    await todoTable.InsertAsync(todoItem);           &lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Push data to Azure Mobile Services storage from offline database&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below push the data to Azure Mobile Services from offline storage&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; async &lt;span class="kwrd"&gt;void&lt;/span&gt; Push()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt; errorString = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        await App.MobileService.SyncContext.PushAsync();&lt;/pre&gt;&lt;pre&gt;        &lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt; (MobileServicePushFailedException ex)&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        errorString = &lt;span class="str"&gt;"Push failed because of sync errors: "&lt;/span&gt; + ex.PushResult.Errors.Count() + &lt;/pre&gt;&lt;pre&gt;            &lt;span class="str"&gt;", message: "&lt;/span&gt; + ex.Message;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        errorString = &lt;span class="str"&gt;"Push failed: "&lt;/span&gt; + ex.Message;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (errorString != &lt;span class="kwrd"&gt;null&lt;/span&gt;) {&lt;/pre&gt;&lt;pre&gt;        MessageDialog d = &lt;span class="kwrd"&gt;new&lt;/span&gt; MessageDialog(errorString);&lt;/pre&gt;&lt;pre class="alt"&gt;        await d.ShowAsync();&lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Pull data to local database from Azure Mobile Services storage&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below pull the data from Azure Mobile Services storage to local database which is used as offline storage.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The following MSDN code samples provides reference on the new Azure Mobile Services offline support.&lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/Azure-Mobile-Get-Started-e4c36566"&gt;&lt;font size="3" face="Calibri"&gt;Azure Mobile Services - Get Started with Offline&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/Azure-Mobile-Handling-6e8538a0"&gt;&lt;font size="3" face="Calibri"&gt;Azure Mobile Services - Handling Conflicts with Offline&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/Azure-Mobile-Service-678a5855"&gt;&lt;font size="3" face="Calibri"&gt;Azure Mobile Service sample - Insurance agency&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Microsoft Azure Mobile Services has been evolving with lot of new features which lets the Mobile Services developers to develop compelling mobile apps. The new offline support is a very useful feature while building mobile apps . In this post, we have configured our Windows Store app to working with an offline storage in SQLite database. The Mobile Services client SDK provides API for syncing data between offline database and Mobile Services database.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can follow me on Twitter &lt;/font&gt;&lt;a href="https://twitter.com/shijucv"&gt;&lt;font size="3" face="Calibri"&gt;@shijucv&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;</description><pubDate>Sun, 06 Apr 2014 10:54:48 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/microsoft-azure-mobile-services-managed-client-sdk-with-offline-support</guid><category>.Net</category><category>Azure</category><category>Mobile Services</category></item><item><title>ASP.NET Web API/AngularJS SPA Demo App Updated</title><link>https://weblogs.asp.net:443/shijuvarghese/asp-net-web-api-angularjs-spa-demo-app-updated</link><description>&lt;p&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;A while ago, I had &lt;/font&gt;&lt;a href="http://weblogs.asp.net/shijuvarghese/archive/2014/01/25/demo-spa-app-for-asp-net-web-api-2-and-angularjs.aspx" target="_blank"&gt;&lt;font face="Calibri"&gt;announced&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; a single page application (SPA) &lt;/font&gt;&lt;a href="https://github.com/MarlabsInc/webapi-angularjs-spa" target="_blank"&gt;&lt;font face="Calibri"&gt;demo&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;, built with ASP.NET Web API 2 and AngularJS. Recently, we have been updated the source on both server-side and client-side. The current version (v1.1.0) of the demo app available on github at &lt;/font&gt;&lt;a title="https://github.com/MarlabsInc/webapi-angularjs-spa" href="https://github.com/MarlabsInc/webapi-angularjs-spa"&gt;&lt;font face="Calibri"&gt;https://github.com/MarlabsInc/webapi-angularjs-spa&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;.&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Summary of Changes in the v1.1.0&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The information below provides the summary of the changes made on the current version:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt;API services and Web, app are separated into two projects - ResourceMetadata.API and ResourceMetadata.Web &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;ASP.NET Identity integrated to the REST API services.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Leveraged &lt;/font&gt;&lt;a href="http://www.nuget.org/packages/Microsoft.Owin.Security.OAuth" target="_blank"&gt;&lt;font size="3" face="Calibri"&gt;Microsoft.Owin.Security.OAuth&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; on the REST API services.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;AngularJS version changed to v1.2.11.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;AngularJS factory &lt;/font&gt;&lt;a href="http://docs.angularjs.org/api/ngResource/service/$resource" target="_blank"&gt;&lt;font size="3" face="Calibri"&gt;$resource&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; used for interacting with RESTful server-side data sources.( In the previous version, it was used $http for interacting with REST API services)&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Leveraged AngularJS $http interceptors.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Task automation done with Gulp.js&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Building and running the application&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Get the latest source from &lt;/font&gt;&lt;a title="https://github.com/MarlabsInc/webapi-angularjs-spa" href="https://github.com/MarlabsInc/webapi-angularjs-spa"&gt;&lt;font size="3" face="Calibri"&gt;https://github.com/MarlabsInc/webapi-angularjs-spa&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Build the solution in Visual Studio 2013 to install Nuget packages.(This will automatically restore Nuget packages. Please ensure you have Nuget version 2.7 or higher)&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Before running the client Application (ResourceMetadata.Web), please ensure that the API project is running in IIS or IIS express.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Config.js file at ResourceMetadata.Web/Scripts/config.js holds the api url used by the client application. Update this file to change the api url appropriately.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;If you haven't installed Node.js, download and install it from &lt;/font&gt;&lt;a href="http://nodejs.org/"&gt;&lt;font size="3" face="Calibri"&gt;http://nodejs.org/&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Install gulp.js globally on your machine by running the command &lt;strong&gt;npm install gulp –g&lt;/strong&gt;.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Navigate to the directory of ResourceMetadata.Web project in command prompt and rum command &lt;strong&gt;npm install &lt;/strong&gt;to install required Node.js modules onto the project.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Navigate to the directory of ResourceMetadata.Web project in command prompt and rum command &lt;strong&gt;gulp build&lt;/strong&gt;&amp;#160; to perform automation tasks before running the client app.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Run the client application.&lt;/font&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Please note that if you are using an old version (v1.0.0) of the demo app, please drop the existing database ResourceMetadata from your SQL server before running the application. For a reference for task automation with gulp.js, check out my blogs post &lt;/font&gt;&lt;a href="http://weblogs.asp.net/shijuvarghese/archive/2014/02/19/gulp-js-a-better-alternative-to-grunt-js.aspx" target="_blank"&gt;&lt;font face="Calibri"&gt;Gulp.js : A Better Alternative to Grunt.js&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Upcoming features&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="3" face="Calibri"&gt;Unit tests with Jasmine/Karma.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Leverage &lt;/font&gt;&lt;a href="http://browserify.org/" target="_blank"&gt;&lt;font face="Calibri"&gt;Browserify&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; to bring Node.js require(&amp;quot;module&amp;quot;) syntax to the browser for better module management on the client-side. &lt;/font&gt;&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Lot of people have been asking to me for providing documentation and articles for this project for building single page applications (SPA). I will provide few article about this project on bit later. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can follow me on Twitter &lt;/font&gt;&lt;a href="https://twitter.com/shijucv"&gt;&lt;font size="3" face="Calibri"&gt;@shijucv&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;</description><pubDate>Sat, 05 Apr 2014 08:32:44 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/asp-net-web-api-angularjs-spa-demo-app-updated</guid><category>.Net</category><category>AngularJS</category><category>ASP.NET Web API</category><category>Node.js</category></item><item><title>Node.js Tools for Visual Studio 2013 Beta Released</title><link>https://weblogs.asp.net:443/shijuvarghese/node-js-tools-for-visual-studio-2013-beta-released</link><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;A while ago, I had introduced Node.js Tools for Visual Studio for building a &lt;a href="http://weblogs.asp.net/shijuvarghese/archive/2013/11/24/deploying-a-node-js-web-site-on-windows-azure-using-node-js-tools-for-visual-studio.aspx" target="_blank"&gt;Node.js Web Site on Microsoft Azure&lt;/a&gt;. Last day,&amp;#160; &lt;a href="http://nodejstools.codeplex.com/" target="_blank"&gt;Node.js Tools for Visual Studio team&lt;/a&gt; has released a beta version of Node.js Tools for Visual Studio, which provides an improved tooling experience than the previous version. You can download the latest version of Node.js Tools for Visual Studio from its &lt;a href="https://nodejstools.codeplex.com/" target="_blank"&gt;CodePlex&lt;/a&gt; site.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Node.js Tools for Visual Studio provides (NTVS) is a full-fledged IDE for building Node.js apps with the well known productivity and tolling features of Visual Studio. NTVS provides productivity features such as Intellisense and UI for NPM, support for TypeScript, better debugging experience on both locally and remotely, profiling tools, publishing apps and tooling experience for working with Microsoft Azure Web Sites and Cloud Service. NTVS is an excellent choice of IDE for building Node.js apps on the Microsoft Azure platform as we can easily deploy Node.js apps to Azure by leveraging the publishing capabilities of Visual Studio. &lt;/font&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Here’s the new project template for Node.js&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_5FD1051D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_73ECB257.png" width="554" height="283" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Here’s the improved UI for NPM&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_101F8BE7.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_16D5261B.png" width="566" height="385" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can follow me on Twitter &lt;/font&gt;&lt;a href="https://twitter.com/shijucv"&gt;&lt;font size="3" face="Calibri"&gt;@shijucv&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;</description><pubDate>Sat, 05 Apr 2014 05:26:51 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/node-js-tools-for-visual-studio-2013-beta-released</guid><category>Azure</category><category>JavaScript</category><category>Node.js</category></item><item><title>Microsoft Azure Updates -- April 2014</title><link>https://weblogs.asp.net:443/shijuvarghese/microsoft-azure-updates-april-2014</link><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;At the Build 2014 conference, Microsoft announces lot of exciting things which including updates on Microsoft Azure. Now Windows Azure has been rebranded as Microsoft Azure. This is good for Azure platform since Azure is a cross platform, which provides a polyglot Cloud platform for multiple operating systems. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;New Azure Portal&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;font size="3" face="Calibri"&gt;At Build 2014, a new &lt;a href="https://portal.azure.com/" target="_blank"&gt;azure portal&lt;/a&gt; has been announced, which provides mind blowing UI experience.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_25605DB3.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_7B9CE2BF.png" width="625" height="432" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Basic tier of compute instances&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Now Microsoft Azure introduces a new entry-level tier named Basic for computing instances. The new Basic tier of compute instances provides similar CPU and memory configurations as the Standard tier of instances with lesser cost. Unlike Standard tier of instances, the Basic tier doesn’t provide load-balancing and automatic scaling features. The Basic tier provides cost up to 26.67 percentage less than a Standard tier of compute instances.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_3F90A10A.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_651A1E6B.png" width="506" height="133" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Microsoft Azure Update Summary&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The information below provides the summary of updates announced during Build 2014.&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;New Azure portal at &lt;/font&gt;&lt;a href="https://portal.azure.com/"&gt;&lt;font size="3" face="Calibri"&gt;https://portal.azure.com/&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt;.&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;A new entry-level Basic tier for computing instances.&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;Azure Active Directory Premium now generally available.&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;&lt;a href="http://azure.microsoft.com/en-us/services/scheduler/" target="_blank"&gt;Scheduler&lt;/a&gt; now generally available.&amp;#160; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;Read-Access Geographically Redundant Storage now generally available.&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;Virtual Network Dynamic Routing Gateway and Point-to-Site now generally available.&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;AutoScale now generally available.&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;Azure &lt;a href="http://azure.microsoft.com/en-us/services/automation/" target="_blank"&gt;Automation&lt;/a&gt; public preview now available.&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;Offline support to Windows Azure Mobile Services.&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="left"&gt;&lt;font size="3" face="Calibri"&gt;&lt;a href="http://azure.microsoft.com/en-us/pricing/details/backup/" target="_blank"&gt;Price reduction&lt;/a&gt; for Azure Backup service.&lt;/font&gt;        &lt;br /&gt;&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;</description><pubDate>Fri, 04 Apr 2014 04:21:43 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/microsoft-azure-updates-april-2014</guid><category>Azure</category><category>Mobile Services</category></item><item><title>Windows Azure Mobile Services with .NET Backend</title><link>https://weblogs.asp.net:443/shijuvarghese/windows-azure-mobile-services-with-net-backend</link><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In this post, I will take a look at the new .NET support provided in Windows Azure Mobile Services for building mobile backend. Windows Azure Mobile Services was a technology based on Node.js, where we write backend code in JavaScript and we can leverage the Node.js ecosystem including NPM modules. But with the new release of &lt;font size="3" face="Calibri"&gt;Windows Azure Mobile Services, we can also build Mobile Services backend with .NET, which is a ASP.NET Web API based infrastructure. This is super exciting feature to .Net developers as developers can now work with Visual Studio 2013 for building Mobile Services backend with .NET where they can debug, test and run applications locally with their favourite IDE Visual Studio. For ASP.NET Web API developers, they can work with Mobile Services using their existing skills. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Creating Windows Azure Mobile Services with .NET&lt;/strong&gt;&lt;/font&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s create new Windows Azure Mobile Services with .NET backend. When we create a new Mobile Services, we can specify the backend as JavaScript (Node.js) or .NET. Let’s choose .NET as backend for our new Mobile Services.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_7242BD1D.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_6972B4D1.png" width="616" height="382" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The figure below shows that the new mobile services has been created. We can choose our preferred client development platform from the available platforms.&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_0E23CC49.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_4C3CE6FA.png" width="624" height="322" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s choose client development platform. Let’s choose Windows Store and select Create a New Windows Store app under getting started:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/portal_097D9BC2.png"&gt;&lt;img title="portal" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="portal" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/portal_thumb_205C6D3E.png" width="635" height="374" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s choose language as C# and download, which will provide a Visual Studio 2013 solution with boilerplate code for working with table Todoitem&amp;#160; for both backend and client app. The Mobile Services project is a ASP.NET Web API project where a NuGet package for Mobile Services added to the ASP.NET Web API project. The below figure shows the solution structure.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_7698F24A.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_108CB26D.png" width="265" height="300" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below provides the implementation of TodoItemController which provides Web API methods for creating CRUD operations against the table Todoitem&amp;#160; &lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; TodoItemController : TableController&amp;lt;TodoItem&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Initialize(HttpControllerContext&lt;/pre&gt;

  &lt;pre&gt; controllerContext)&lt;/pre&gt;

  &lt;pre class="alt"&gt;{&lt;/pre&gt;

  &lt;pre&gt;  &lt;span class="kwrd"&gt;base&lt;/span&gt;.Initialize(controllerContext);&lt;/pre&gt;

  &lt;pre class="alt"&gt;  zumodotnetContext context = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;/pre&gt;

  &lt;pre&gt;zumodotnetContext(Services.Settings.Name.Replace(&lt;span class="str"&gt;'-'&lt;/span&gt;, &lt;span class="str"&gt;'_'&lt;/span&gt;));&lt;/pre&gt;

  &lt;pre class="alt"&gt;    DomainManager = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;/pre&gt;

  &lt;pre&gt;EntityDomainManager&amp;lt;TodoItem&amp;gt;(context, Request, Services);&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="rem"&gt;// GET tables/TodoItem&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; IQueryable&amp;lt;TodoItem&amp;gt; GetAllTodoItems()&lt;/pre&gt;

  &lt;pre class="alt"&gt;{&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; Query();&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="rem"&gt;// GET tables/TodoItem/48D68C86-6EA6-4C25-AA33-223FC9A27959&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; SingleResult&amp;lt;TodoItem&amp;gt; GetTodoItem(&lt;span class="kwrd"&gt;string&lt;/span&gt; id)&lt;/pre&gt;

  &lt;pre class="alt"&gt;{&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; Lookup(id);&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="rem"&gt;// PATCH tables/TodoItem/48D68C86-6EA6-4C25-AA33-223FC9A27959&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; Task&amp;lt;TodoItem&amp;gt; PatchTodoItem(&lt;span class="kwrd"&gt;string&lt;/span&gt; id,&lt;/pre&gt;

  &lt;pre class="alt"&gt;   Delta&amp;lt;TodoItem&amp;gt; patch)&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; UpdateAsync(id, patch);&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="rem"&gt;// POST tables/TodoItem/48D68C86-6EA6-4C25-AA33-223FC9A27959&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; async Task&amp;lt;IHttpActionResult&amp;gt; PostTodoItem(&lt;/pre&gt;

  &lt;pre&gt;                                     TodoItem item)&lt;/pre&gt;

  &lt;pre class="alt"&gt;{          &lt;/pre&gt;

  &lt;pre&gt;    TodoItem current = await InsertAsync(item);&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; CreatedAtRoute(&lt;span class="str"&gt;&amp;quot;Tables&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;new&lt;/span&gt; { id = current.Id }, current);&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="rem"&gt;// DELETE tables/TodoItem/48D68C86-6EA6-4C25-AA33-223FC9A27959&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; Task DeleteTodoItem(&lt;span class="kwrd"&gt;string&lt;/span&gt; id)&lt;/pre&gt;

  &lt;pre class="alt"&gt;{&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; DeleteAsync(id);&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below provides the TodoItem model.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; TodoItem : EntityData&lt;/pre&gt;

  &lt;pre class="alt"&gt;    {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Text { get; set; }     &lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; Complete { get; set; }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    }&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;



&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s add one more column to the TodoItem model for the sake of demo.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; TodoItem : EntityData&lt;/pre&gt;

  &lt;pre&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Text { get; set; }&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Description { get; set; }&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; Complete { get; set; }&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;



&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The advantage of using .NET backend is that you can easily debug, test and the app locally from Visual Studio. The ASP.NET Web API app also provides a help page that provides help for invoking REST API endpoints.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/runningtheapp_local_3228DB3E.png"&gt;&lt;img title="runningtheapp_local" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="runningtheapp_local" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/runningtheapp_local_thumb_6FD5C2FA.png" width="728" height="312" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_6D4C913C.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_275B5E1C.png" width="630" height="322" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/post_test_092DA068.png"&gt;&lt;img title="post_test" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="post_test" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/post_test_thumb_433C6D47.png" width="438" height="439" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Deploying Windows Azure Mobile Services&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can deploy the Windows Azure mobile Services in the someway we are deploying a Windows Azure Web Site. Just right click on the Mobile Services project, and click publish, it will publish the mobile services project to Windows Azure. For the first time, we need to download the publish profile from Windows Azure portal and import the publishing profile using the publish wizard in Visual Studio.&amp;#160; &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can follow me on Twitter &lt;a href="https://twitter.com/shijucv" target="_blank"&gt;@shijucv&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;</description><pubDate>Fri, 21 Feb 2014 10:36:57 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/windows-azure-mobile-services-with-net-backend</guid><category>.Net</category><category>ASP.NET Web API</category><category>Azure</category><category>Mobile Services</category><category>Windows Azure</category></item><item><title>Gulp.js : A Better Alternative to Grunt.js</title><link>https://weblogs.asp.net:443/shijuvarghese/gulp-js-a-better-alternative-to-grunt-js</link><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Recently, we have started a single page application (SPA) demo in &lt;a href="https://github.com/MarlabsInc/webapi-angularjs-spa" target="_blank"&gt;github&lt;/a&gt; with AngularJS. When we start this project, my plan was to use Grunt.js for task automation. But later, I have observed that there is a new framework named &lt;a href="http://gulpjs.com/" target="_blank"&gt;Gulp.js&lt;/a&gt;, that provides more cleaner and elegant syntax, which is easy to read and easy to write comparing to Grunt.js. Then I have evaluated the framework and really impressed with Gulp.js. Now I highly recommend Gulp.js over Grunt.js mainly due to its cleaner syntax.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="https://raw2.github.com/gulpjs/artwork/master/gulp-2x.png" width="141" height="263" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Getting Started with Gulp.js&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Like Grunt.js, Gulp.js is also provides as a NPM module so that you can install it through NPM. In order to working Gulp.js, you need to install Gulp globally and locally for your project.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;The command below install gulp globally on your machine.&lt;/font&gt;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;npm install –g gulp&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You also need to install gulp locally for your project. If you haven’t a package.json file for your project, just create it.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The command below install gulp locally and will automatically add dependency into the devDependencies of package.json. &lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;npm install --save-dev gulp&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Now we have installed Gulp.js. The next step is to add a Gulp file named “gulpfile.js” for automating our tasks for the project. Let’s add a gulpfile.js file. The code block below shows a basic gulpfile.js file where we are just specifying a task named “build” by using the Node.js module gulp.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; gulp = require(&lt;span class="str"&gt;'gulp'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;gulp.task(&lt;span class="str"&gt;'build'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

  &lt;pre&gt;});&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Automating Tasks with Gulp.js&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;There are lot of useful &lt;a href="http://gulpjs.com/plugins/" target="_blank"&gt;plugins&lt;/a&gt; are available for Gulp.js, which can be used for building most of the commonly used task automations. When I write this post, there are 310 gulp plugins available for automating your tasks. All plugins can install by using npm.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Minifying JavaScript Code&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s automate our tasks in the AngularJS SPA reference app &lt;a href="https://github.com/MarlabsInc/webapi-angularjs-spa" target="_blank"&gt;webapi-angularjs-spa&lt;/a&gt;. &lt;/font&gt;&lt;font size="3" face="Calibri"&gt;Let’s start our automation tasks with minifying our JavaScript code files. For this task, we are using the following gulp plugins:&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;font size="3" face="Calibri"&gt;gulp-uglify &lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font size="3" face="Calibri"&gt;gulp-concat&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="3" face="Calibri"&gt;gulp-size&lt;/font&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The above plugins are using for minifying, concatenating minified files and getting size of the minified file respectively.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s install these npm modules.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;npm install --save-dev gulp-uglify gulp-concat gulp-size&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below shows a task named “app-js-minify” which minifies all JavaScript files written in AngularJS. &lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; filePath = {&lt;/pre&gt;

  &lt;pre&gt;    appjsminify: { src: &lt;span class="str"&gt;'./app/**/*.js'&lt;/span&gt;, dest: &lt;span class="str"&gt;'./app'&lt;/span&gt; },&lt;/pre&gt;

  &lt;pre class="alt"&gt;    libsjsminify: { src: [&lt;span class="str"&gt;'libs/**/*.js'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt; &lt;span class="str"&gt;'!*.min.js'&lt;/span&gt;, &lt;span class="str"&gt;'!/**/*.min.js'&lt;/span&gt;], dest: &lt;span class="str"&gt;'libs/'&lt;/span&gt; },&lt;/pre&gt;

  &lt;pre class="alt"&gt;    jshint: { src: &lt;span class="str"&gt;'./app/**/*.js'&lt;/span&gt; },&lt;/pre&gt;

  &lt;pre&gt;    minifycss: { src: [&lt;span class="str"&gt;'../Content/themes/**/*.css'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;span class="str"&gt;'!*.min.css'&lt;/span&gt;, &lt;span class="str"&gt;'!/**/*.min.css'&lt;/span&gt;],&lt;/pre&gt;

  &lt;pre&gt;  dest: &lt;span class="str"&gt;'../Content/themes/'&lt;/span&gt; }&lt;/pre&gt;

  &lt;pre class="alt"&gt;};&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;gulp.task(&lt;span class="str"&gt;'app-js-minify'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    gulp.src(filePath.appjsminify.src)&lt;/pre&gt;

  &lt;pre&gt;        .pipe(uglify())&lt;/pre&gt;

  &lt;pre class="alt"&gt;        .pipe(concat(&lt;span class="str"&gt;'ngscripts.js'&lt;/span&gt;))&lt;/pre&gt;

  &lt;pre&gt;        .pipe(size())&lt;/pre&gt;

  &lt;pre class="alt"&gt;        .pipe(gulp.dest(filePath.appjsminify.dest));&lt;/pre&gt;

  &lt;pre&gt;});&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;In the above code block, we are specifying the code files to be minified by using the src method of gulp. We use gulp’s method .pipe() to pipe the source files into a gulp plugin. The concat function bundles all minified files to a file named “ngscripts.js” into a destination folder that specified using the function dest. The size returns the size of the minified file “ngscripts.js”. We have specified all files paths in a variable filepath. By default, tasks in Gulp.js, will be executed asynchronously.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s run our first task “app-js-minify” by run the command “gulp app-js-minify” as shown in below figure.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_2F8FCEA5.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://aspblogs.blob.core.windows.net/media/shijuvarghese/Media/image_thumb_3BB148CC.png" width="602" height="198" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Automating Unit Tests with Mocha&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;Let’s automate our unit tests with Gulp. We use the gulp plugin “gulp-mocha&amp;quot; for automating unit tests with Mocha.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;gulp.task(&lt;span class="str"&gt;'mocha'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

  &lt;pre&gt;    gulp.src(&lt;span class="str"&gt;'./test/*.js'&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre class="alt"&gt;        .pipe(mocha({ reporter: &lt;span class="str"&gt;'list'&lt;/span&gt; }));&lt;/pre&gt;

  &lt;pre&gt;});&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;strong&gt;Minifying CSS&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;We use gulp plugin&lt;/font&gt; “&lt;font size="3" face="Calibri"&gt;gulp-minify-css” for minifying CSS files. In this task we also use a gulp &lt;font size="3" face="Calibri"&gt;plugin&lt;/font&gt; “gulp-rename” for rename the file.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;gulp.task(&lt;span class="str"&gt;'minify-css'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt; () {    &lt;/pre&gt;

  &lt;pre&gt;    gulp.src(filePath.minifycss.src)&lt;/pre&gt;

  &lt;pre class="alt"&gt;    .pipe(minifycss())&lt;/pre&gt;

  &lt;pre&gt;    .pipe(rename({ suffix: &lt;span class="str"&gt;'.min'&lt;/span&gt; }))&lt;/pre&gt;

  &lt;pre class="alt"&gt;    .pipe(gulp.dest(filePath.minifycss.dest));&lt;/pre&gt;

  &lt;pre&gt;});&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The below &lt;a href="https://github.com/MarlabsInc/webapi-angularjs-spa/blob/master/source/ResourceMetadata/ResourceMetadata.Web/Scripts/gulpfile.js" target="_blank"&gt;gulpfile&lt;/a&gt; is taken from our &lt;a href="https://github.com/MarlabsInc/webapi-angularjs-spa" target="_blank"&gt;AngularJS SPA demo app&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; gulp = require(&lt;span class="str"&gt;'gulp'&lt;/span&gt;),&lt;/pre&gt;

  &lt;pre&gt;    gutil = require(&lt;span class="str"&gt;'gulp-util'&lt;/span&gt;),&lt;/pre&gt;

  &lt;pre class="alt"&gt;    uglify = require(&lt;span class="str"&gt;'gulp-uglify'&lt;/span&gt;),&lt;/pre&gt;

  &lt;pre&gt;    jshint = require(&lt;span class="str"&gt;'gulp-jshint'&lt;/span&gt;),&lt;/pre&gt;

  &lt;pre class="alt"&gt;    concat = require(&lt;span class="str"&gt;'gulp-concat'&lt;/span&gt;),&lt;/pre&gt;

  &lt;pre&gt;    jshintreporter = require(&lt;span class="str"&gt;'jshint-stylish'&lt;/span&gt;),&lt;/pre&gt;

  &lt;pre class="alt"&gt;    minifycss = require(&lt;span class="str"&gt;'gulp-minify-css'&lt;/span&gt;),&lt;/pre&gt;

  &lt;pre&gt;    size = require(&lt;span class="str"&gt;'gulp-size'&lt;/span&gt;),&lt;/pre&gt;

  &lt;pre class="alt"&gt;    clean = require(&lt;span class="str"&gt;'gulp-clean'&lt;/span&gt;),&lt;/pre&gt;

  &lt;pre&gt;    rename = require(&lt;span class="str"&gt;'gulp-rename'&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; filePath = {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    appjsminify: { src: &lt;span class="str"&gt;'./app/**/*.js'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt; dest: &lt;span class="str"&gt;'./app'&lt;/span&gt; },&lt;/pre&gt;

  &lt;pre class="alt"&gt;    libsjsminify: { src: [&lt;span class="str"&gt;'libs/**/*.js'&lt;/span&gt;, &lt;span class="str"&gt;'!*.min.js'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt; &lt;span class="str"&gt;'!/**/*.min.js'&lt;/span&gt;], dest: &lt;span class="str"&gt;'libs/'&lt;/span&gt; },&lt;/pre&gt;

  &lt;pre class="alt"&gt;    jshint: { src: &lt;span class="str"&gt;'./app/**/*.js'&lt;/span&gt; },&lt;/pre&gt;

  &lt;pre&gt;    minifycss: { src: [&lt;span class="str"&gt;'../Content/themes&lt;/pre&gt;

  &lt;pre class="alt"&gt;    /**/*.css'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt; &lt;span class="str"&gt;'!*.min.css'&lt;/span&gt;, &lt;span class="str"&gt;'!/**/*.min.css'&lt;/span&gt;], &lt;/pre&gt;

  &lt;pre class="alt"&gt;dest: &lt;span class="str"&gt;'../Content/themes/'&lt;/span&gt; }&lt;/pre&gt;

  &lt;pre&gt;};&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;gulp.task(&lt;span class="str"&gt;'app-js-minify'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

  &lt;pre&gt;    gulp.src(filePath.appjsminify.src)&lt;/pre&gt;

  &lt;pre class="alt"&gt;        .pipe(uglify())&lt;/pre&gt;

  &lt;pre&gt;        .pipe(concat(&lt;span class="str"&gt;'ngscripts.js'&lt;/span&gt;))&lt;/pre&gt;

  &lt;pre class="alt"&gt;        .pipe(size())&lt;/pre&gt;

  &lt;pre&gt;        .pipe(gulp.dest(filePath.appjsminify.dest));&lt;/pre&gt;

  &lt;pre class="alt"&gt;});&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;gulp.task(&lt;span class="str"&gt;'libs-js-minify'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="rem"&gt;/*Excludes already minified files.*/&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    gulp.src(filePath.libsjsminify.src)&lt;/pre&gt;

  &lt;pre&gt;    .pipe(uglify())&lt;/pre&gt;

  &lt;pre class="alt"&gt;    .pipe(rename({ suffix: &lt;span class="str"&gt;'.min'&lt;/span&gt; }))&lt;/pre&gt;

  &lt;pre&gt;    .pipe(gulp.dest(filePath.libsjsminify.dest));&lt;/pre&gt;

  &lt;pre class="alt"&gt;});&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;gulp.task(&lt;span class="str"&gt;'jshint'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

  &lt;pre class="alt"&gt;    gulp.src(filePath.jshint.src)&lt;/pre&gt;

  &lt;pre&gt;      .pipe(jshint())&lt;/pre&gt;

  &lt;pre class="alt"&gt;      .pipe(jshint.reporter(jshintreporter));&lt;/pre&gt;

  &lt;pre&gt;});&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;gulp.task(&lt;span class="str"&gt;'minify-css'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="rem"&gt;/*Excludes already minified files.*/&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    gulp.src(filePath.minifycss.src)&lt;/pre&gt;

  &lt;pre&gt;    .pipe(minifycss())&lt;/pre&gt;

  &lt;pre class="alt"&gt;    .pipe(rename({ suffix: &lt;span class="str"&gt;'.min'&lt;/span&gt; }))&lt;/pre&gt;

  &lt;pre&gt;    .pipe(gulp.dest(filePath.minifycss.dest));&lt;/pre&gt;

  &lt;pre class="alt"&gt;});&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;gulp.task(&lt;span class="str"&gt;'clean'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt; () {&lt;/pre&gt;

  &lt;pre&gt;    gulp.src(&lt;/pre&gt;

  &lt;pre class="alt"&gt;        [&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="str"&gt;'app/ngscripts.js'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="str"&gt;'libs/angular-ui/select2.min.js'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="str"&gt;'libs/select2/select2.min.js'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="str"&gt;'libs/semantic/semantic.min.js'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="str"&gt;'libs/jquery-1.9.1.min.js'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="str"&gt;'../Content/themes/semantic/&lt;/pre&gt;

  &lt;pre&gt;              semantic.min.css'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="str"&gt;'../Content/themes/Site.min.css'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="str"&gt;'../Content/themes/select2/&lt;/pre&gt;

  &lt;pre class="alt"&gt;            select2.min.css'&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;        ], { read: &lt;span class="kwrd"&gt;false&lt;/span&gt; })&lt;/pre&gt;

  &lt;pre class="alt"&gt;    .pipe(clean({force:&lt;span class="kwrd"&gt;true&lt;/span&gt;}));&lt;/pre&gt;

  &lt;pre&gt;});&lt;/pre&gt;

  &lt;pre class="alt"&gt;gulp.task(&lt;span class="str"&gt;'build'&lt;/span&gt;, [&lt;span class="str"&gt;'app-js-minify'&lt;/span&gt;, &lt;span class="str"&gt;'libs-js-minify'&lt;/span&gt;, &lt;span class="str"&gt;'minify-css'&lt;/span&gt;]);&lt;/pre&gt;

  &lt;pre&gt;gulp.task(&lt;span class="str"&gt;'cleanbuild'&lt;/span&gt;, [&lt;span class="str"&gt;'clean'&lt;/span&gt;]);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can run the gulp task by specifying the task name. In the above gulpfile, we are specifying two tasks at the end of the section named “build” and “cleanbuild” where we are specifying logically related group of tasks. You can pass these tasks as an array of defined tasks.&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;gulp.task(&lt;span class="str"&gt;'build'&lt;/span&gt;, [&lt;span class="str"&gt;'app-js-minify'&lt;/span&gt;, &lt;span class="str"&gt;'libs-js-minify'&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt; &lt;span class="str"&gt;'minify-css'&lt;/span&gt;]);&lt;/pre&gt;

  &lt;pre class="alt"&gt;gulp.task(&lt;span class="str"&gt;'cleanbuild'&lt;/span&gt;, [&lt;span class="str"&gt;'clean'&lt;/span&gt;]);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;



&lt;p&gt;&lt;font size="3" face="Calibri"&gt;When we run “gulp build” it will run tasks “app-js-minify”, “libs-js-minify” and “minify-css”. When we run “gulp cleanbuild” it will run the task “clean”. If you are simply running gulp without specifying any task, it will look for the task with name “default”.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;The code block below provides the package.json file of the project&lt;/font&gt;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;{&lt;/pre&gt;

  &lt;pre&gt;  &lt;span class="str"&gt;&amp;quot;name&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;webapi-angularjs-spa&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;  &lt;span class="str"&gt;&amp;quot;description&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;SPA Demo app with AngularJS&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;  &lt;span class="str"&gt;&amp;quot;author&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;Shiju Varghese&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;  &lt;span class="str"&gt;&amp;quot;version&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;0.5.0&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;  &lt;span class="str"&gt;&amp;quot;repository&amp;quot;&lt;/span&gt;: &lt;/pre&gt;

  &lt;pre class="alt"&gt;      &lt;span class="str"&gt;&amp;quot;https://github.com/MarlabsInc/webapi-angularjs-spa&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;  &lt;span class="str"&gt;&amp;quot;dependencies&amp;quot;&lt;/span&gt;: {},&lt;/pre&gt;

  &lt;pre class="alt"&gt;  &lt;span class="str"&gt;&amp;quot;devDependencies&amp;quot;&lt;/span&gt;: {&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="str"&gt;&amp;quot;gulp-util&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;~2.2.14&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="str"&gt;&amp;quot;gulp&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;~3.5.2&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="str"&gt;&amp;quot;gulp-concat&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;~2.1.7&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="str"&gt;&amp;quot;gulp-uglify&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;~0.2.1&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="str"&gt;&amp;quot;jshint&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;~2.4.3&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="str"&gt;&amp;quot;gulp-jshint&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;~1.4.2&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="str"&gt;&amp;quot;jshint-stylish&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;~0.1.5&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="str"&gt;&amp;quot;gulp-minify-css&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;~0.3.0&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="str"&gt;&amp;quot;gulp-rename&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;~1.1.0&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="str"&gt;&amp;quot;gulp-size&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;~0.1.3&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="str"&gt;&amp;quot;gulp-clean&amp;quot;&lt;/span&gt;: &lt;span class="str"&gt;&amp;quot;~0.2.4&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;  }&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;font size="4" face="Calibri"&gt;&lt;strong&gt;Source Code&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;We have implemented the task automation in our AngularJS demo app which is available on github at &lt;a title="https://github.com/MarlabsInc/webapi-angularjs-spa" href="https://github.com/MarlabsInc/webapi-angularjs-spa" target="_blank"&gt;https://github.com/MarlabsInc/webapi-angularjs-spa&lt;/a&gt;. The JavaScript client app is available from the location &lt;a href="https://github.com/MarlabsInc/webapi-angularjs-spa/tree/master/source/ResourceMetadata/ResourceMetadata.Web/Scripts" target="_blank"&gt;here&lt;/a&gt;. The gulpfile is available from &lt;a href="https://github.com/MarlabsInc/webapi-angularjs-spa/blob/master/source/ResourceMetadata/ResourceMetadata.Web/Scripts/gulpfile.js" target="_blank"&gt;here&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;You can follow me on Twitter &lt;/font&gt;&lt;a href="https://twitter.com/shijucv"&gt;&lt;font size="3" face="Calibri"&gt;@shijucv&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;</description><pubDate>Wed, 19 Feb 2014 08:29:58 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/gulp-js-a-better-alternative-to-grunt-js</guid><category>AngularJS</category><category>JavaScript</category><category>Node.js</category></item><item><title>Slides For My Session On Windows Azure Mobile Services</title><link>https://weblogs.asp.net:443/shijuvarghese/slides-for-my-session-on-windows-azure-mobile-services</link><description>&lt;p&gt;&lt;font size="3" face="Calibri"&gt;I did a presentation titled “A Deep Dive Into Windows Azure Mobile Services” at the Kochi DevCon 2014&lt;/font&gt;&lt;font size="3" face="Calibri"&gt;. In this session, I demonstrated how we can write server-side scripts in Windows Azure Mobile Services, by using JavaScript and Node.js. &lt;/font&gt;&lt;font size="3" face="Calibri"&gt;You can download the session slides from &lt;a href="https://speakerdeck.com/shijuvar/a-deep-dive-into-windows-azure-mobile-services" target="_blank"&gt;here&lt;/a&gt;&lt;/font&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;font size="3" face="Calibri"&gt;.&lt;/font&gt;&lt;/p&gt;</description><pubDate>Sun, 16 Feb 2014 12:56:54 GMT</pubDate><guid isPermaLink="true">https://weblogs.asp.net:443/shijuvarghese/slides-for-my-session-on-windows-azure-mobile-services</guid><category>Azure</category><category>Community News</category><category>JavaScript</category><category>Node.js</category><category>Windows Azure</category></item></channel></rss>