Using your DreamSpark Azure accounts with GitHub to build a Node.js application which uses Azure Mobile Services


 

Azure_570x200_Student_AppHeading

The Azure offers available to student via DreamSpark allows you gets you started developing services in the cloud at no cost:

The services offering which this blog is focusing on

  • Azure App Service Web Apps is a part of a fully managed cloud offering that enables you to build and deploy web apps in seconds. you can use technologies such as ASP.NET, Java, PHP, Node.js or Python.

This blog is going to focus on Node.Js and deployment workflows with GitHub, enabling you to automatically build and deploy your application.

Source Control and GitHub

Many institutions request Students to use some form of source control source control DreamSpark offers this for FREE in the form of Visual Studio Online or the GitHub Student Developer Pack.

For this blog I am going to focus on GitHub, I have talked about Visual Studio Online in a number of other blogs see here 

GitHub

student developer pack assembles a great set of tools and services, free to students! Get your own domain name with SSL, explore crowdsourcing, email services, and much more. Combined with the free Visual Studio Community 2015 and Visual Studio Online, it’s an unbeatable combination to get your coding project off the ground. Get your GitHub Student Developer Pack today!

https://www.dreamspark.com/Student/Software-Catalog.aspx

In the following blog I will share how to upload a Node.JS Package from GitHub repository to a Microsoft Azure Mobile Services

Register for your DreamSpark and GitHub accounts

1. Register for your DreamSpark account and an Azure Account for these instructions
2. Now we need to register and download the GitHub Student Developer Pack

Setting up GitHub

  1. You will need a GIT client.

  2. Git is a distributed revision control and source code management (SCM) system a number of colleges and Universities now stimplaute source control must be used,

  3. Git was initially designed and developed by Linus Torvalds for Linux kernel development in 2005.

  4. We will need Git in order to be able to add node.js packages to Azure mobile service.

  5. Once you install, consider a reboot, simply follow the instruction from the installer.

Finding the Azure Mobile Services EndPoint Url

  1. Azure Mobile Services directly supports GitHub

  2. Navigate to the Azure Portal

  3. Select Mobile Services

  4. Select the CONFIGURE menu

  5. COPY THE URL

Once you copy the url to the clipboard, proceed to the next step.

Cloning a Git Repository to an Azure Mobile Web Services

  1. Open up a Command prompt in the desired folder where you want your source control

  2. Type in git clone [ your Azure End Point URL]

Checking the result
  1. You will need to provide a user name and password

  2. Now if you take a look at the  folder (the one I am using),

  3. Now navigate to the folder. you defined it when you created your Azure Mobile Service.

  4. Navigate into the service folder and view the file

  5. You can see the package.json file.

  6. This is the key file to edit.

Node.js application resources

  1. Your first goal is ensure you have your Node.js code and packages on your local machine.

  2. For more details on Noje.Js and Azure see  http://azure.microsoft.com/en-us/develop/nodejs/ 

  3. Ensure that the  package.json, which contains all of the packages that you require to be installed into Azure Mobile Services.

  4. You can’t just copy packages directly to the web services, ou must use Git to copy packages Azure mobile services

Modify the package.json file

  1. Now you will need to modify the package.json file to include new node packages.

  2. For example purposes, we will include the packages qs (QueryString)

    • QS is a query string parser for node and the browser supporting nesting
The json package structure
  1. We need to modify the dependencies section of package.json.

  2. For this example I will be adding an new dependency of quality of service (qs) 

    image007

Simply edit the file in your favourite text editor
  1. Notice the qs is now part of dependencies

    image008

  1. Save and close the package.json

Commit the changes

  1. You will need to commit the changes before you push them up to the portal.

  2. The command is, git commit .

  3. You will be asked to enter in a commit comment. Its always great best practice to add comments to any code revisions so enter a clear and concise comment to change/update undertake.

Pushing changes back to the Azure Mobile Service

  1. Now we need to  push  the changes back to the Azure Mobile Services

  2. The command for this is simple: git push [remote-name] [branch-name].

  3. But we want to push our master branch to the origin server (Azure Mobile Services)

  4. We will push our work back up to Azure Mobile Services with this command:

    • $ git push origin master
  5. We have now successfully pushed up the latest copy of our Node code using Github
  6. We have successfully added the node package qs to our Azure Mobile Services

Checking the update of Node.js Code is live on the Azure Mobile services

  1. We will now make use of the **qs ** package in node.js

    image012

  2. As you can see in the figure above, we are now able to leverage the node package known as qs .

Additional Resources Curriculum & Training

 Using Microsoft Azure for students

 Azure App Service Web Apps Overview

 Node.Js and Azure Developer Center

 Online learning Azure Mobile Services and Node.js

 Using Windows Azure and Node.js – Starting at the basics

Comments (0)

Skip to main content