Create your own URL monitor with AMS 

In this blog I will discuss about the important role of Node.JS module(request) in Azure Mobile Service. I will like to take an example and explain how easily a simple URL monitoring application which took a lot of effort earlier was coded in just few hours.

The new Azure Mobile service provides the developers some standard node.js modules that can help them to code for CRUD related transactions. Richard Astbury has written a wonderful blog mentioning those standard modules. In addition to these standard modules some new modules that have been added recently are as follows:

·         SendGrid

·         Azure

·         Request

We will be talking about the request module which has been recently added as a supported module to Azure mobile service.
Let me start with the problem statement that was the origin of such an app.


·         I have 5 web service hosted by my application. I want to verify their status right now. I want a one click solution for the same

·         I want to monitor whether is up and running.

Application Understanding

Here I will take a reference from my personal experience.

Our approach was coding the client in Windows 8 and have a Azure based service. Our application was having two broad features – Client and Service side. The client side sends a service request to ping In the service side there is an http request made to the website. The website responds back to the service with its status. The next activity was to log the response in the database and finally return it to the user.

Development efforts

During coding we found that we had to invest our efforts in the client side as well as the service side code. Our client was a Windows 8 application that was talking to an Azure based WCF service. We spent a considerable amount of time and effort in coding for our client app, and then we did the same for the WCF service. The coding activity was followed by extensive testing for both client side and server side codes. Finally a considerable effort was made in integration between client and server side code.

With the new Azure Mobile service these efforts have been reduced considerably. The whole chunk of creating server side code, hosting and publishing the same and finally integrating the client app with it has been reduced to merely few steps.

With the new Azure mobile service the effort now has been reduced to only the client side app. Now coding for a URL Monitor Service was a piece of cake for us

1.       Follow the Get Started blog post to create a ToDoList.

2.       Click on the Azure Mobile service and go to the Data section, click on the Script menu item.

3.       Under the Insert tab, paste the following

This script is using the request node.js module to send a post request to . It is then verifying for the response status code. If the status code is 200 then the service assigns the body of the response to the SQL database column name, which in turn stores the data under that column as a new data entry. If the status code is something other than 200, the service saves the response code.

Note: Here I have taken only 2 scenarios, where one is having response status code as 200 and the other having the else part. In real scenario there could be many situations like redirection, sometimes the response body needs to be parsed for some keywords. The above script can be tweaked like wise.

The script was getting called from within Windows 8 client code and the corresponding respond was getting logged in SQL Azure. Node.JS coding had made such Azure Mobile Scripting potent enough to reduce tons of lines in merely few lines of code.


Though there are still many modules to be incorporated in Azure Mobile Service but in this CTP version also it proves to be very promising and robust. The above activity helped us create the sample app within one day in comparison to half a month effort in traditional approach. With the advent of the new Scheduler feature in AMS, we are looking forward for a more powerful monitoring solution which will be an advance version of this.

All in all, it was a great experience for us which I cannot help to share. Hope it might be useful.


Popular posts from this blog

Firebase authentication with Ionic creator

Big Data - SWOT Analysis

LINKEDIN api call using NODE.JS OAUTH module