Windows Azure with Node.js
Windows azure is a windows based cloud services, you can deploy your code and build your apps on the cloud server. Also it has support for all the OS and not just for WIndows. Also you can setup Virtual machine and you can do a Remote desktop to that machine. Which is a nice feature.
As initially when Node.js was launched it was not supporting the windows environment. But later on to use Node.js on the Windows machine and allow user to build and deploy Node.js apps Microsoft has brought Node.js to Windows Azure.
So now we can use Node.js on Windows, we can develop and test Node.js app on the windows machine too.
To do so powershell command prompt is needed and most importantly Windows Azure SDK for Node.js, other than that there are few more essential tools you need to work on Azure and Node.js
Once installation is done then you will see Windows Azure PowerShell for Node.js in your Program files. Run that as “Administrator” to start with your first Node.js app
Few Important commands of Windows Azure
- Start-AzureEmulator -launch
- Get-AzurePublishSettings [file_path]
- Publish-AzureServiceProject –ServiceName –Location -Launch
Its good to remember these commands while working with Windows Azure (Node.js)
Now to start with the first app of Node.js for Windows Azure you have to start with first two commands
“This will create a Azure Service on you local”
“Once you run this command it will create a WebRole folder inside your service and this is the place where you will keep you Node.js code. When we run these two commands, SDK by default creates a Hello World app for us in Node.js”
Now to run this app use the (3) command in the list
“This will launch the web browser with the main page of our app”
If you are done and would like to start with some other code, you can stop the service using command (7)
If you do not need this service and want to remove it then use the command (8)
Now if you are done with your code and want to Publish this app to Windows Azure Cloud then you have to use the command (4), (5) and (6)
To get the AzurePublishSetting on your local so that you could deploy/publish your changes to Cloud, you need to use command (4)
This will popup a download window, you have to download the file and need to keep in your local folder
After getting the file run the command (5) to import these settings
Import-AzurePublishSettings [File path]
Now this will allow you to publish you code to cloud server.
Finally to Publish your code you have to use the command (6) and this will deploy your code to cloud service
Publish-AzureServiceProject –ServiceName –Location -Launch
To learn more about Windows Azure and Windows Azure for Node.js you can use following links