Cloud Zone is brought to you in partnership with:

Daniel Mohl is a professional software engineer/architect whose interests include understanding the intricacies of various programming languages, enterprise application architecture, and how to bridge the gap between business and technology. He works with F#, C#, CoffeeScript, JavaScript, Erlang, ASP.NET MVC, WPF, WCF, Silverlight, WP7, SQL Server, etc. He is a F# MVP, C# Insider, F# Insider, blogger, speaker, and event organizer. You can follow him on twitter at www.twitter.com/dmohl. Daniel is a DZone MVB and is not an employee of DZone and has posted 28 posts at DZone. You can read more from them at their website. View Full User Profile

Announcing FogJS for Windows Azure with Node.js

11.19.2013
| 3655 views |
  • submit to reddit
About a year and a half ago I announced a library named Fog (for F#) that had the goal of making it very easy to use F# to work with the Windows Azure API for .NET. Today, I'm proud to announce the release of FogJS, which has a similar goal for JavaScript/Node.js development.

FogJS:
FogJS currently supports 3 of the more popular Azure services: Blob Storage, Table Storage, and Service Bus. One of the most broad features in FogJS is that of support for promises. In fact, almost every function provided by the Azure SDK for Node.js has been replicated in Fog with the results returned as a promise (with the help of Q.js).

The second big feature is related to making it as easy as possible to interact with Azure. This is primarily accomplished with "simplified functions" that follow a convention over configuration approach.

Example: 

Here's a quick example of one option for how to use Blob Storage with FogJS:
var fog = require("fogjs"); 
var fogBlob = fog.blobStorage;

var containerName = "testcontainer";
var blobName = "testblob";

fogBlob.createBlockBlobFromText({
    "containerName": containerName, 
    "blobName" : blobName, 
    "blobText": "My super awesome text to upload"
}).then(function() {
    return fogBlob.getBlobToText({
        "containerName": containerName, 
        "blobName" : blobName
    });
}).then(function(response) {
    console.log("The blob contains the text: " + response.text);
    return fogBlob.deleteBlob({
        "containerName": containerName, 
        "blobName" : blobName
    });                    
}).then(function(response) {
    console.log("done");
});
You can find examples for Table Storage and Service Bus interaction on the main FogJS site: http://fogjs.azurewebsites.net/.

As usual, the code and tests can be found on my GitHub.


Published at DZone with permission of Daniel Mohl, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)