Avkash Chauhan's Blog

Windows Azure, Windows 8, Cloud Computing, Big Data and Hadoop: All together at one place.. One problem, One solution at One time...

Node.js and Windows Azure: Creating a blog application using Node.JS and Windows Azure Table & Blob Storage Part 1

Node.js and Windows Azure: Creating a blog application using Node.JS and Windows Azure Table & Blob Storage Part 1

Rate This
  • Comments 2

In this example I will create a node.js based blob application which will storage all the blog articles on Azure Storage. When application starts it reads blog article from Windows Azure table storage and then render it using EJS viewer. This sample is part of Azure Node SDK however I am going to enhance it to make it look like a full scale blog application. This is just a start. I will write this blog assume you are a new to node programming. This application uses following node packages:

  • Express
  • EJS
  • Jade
  • Stylus
  • Azure
  • Node-uuid

Let’s start with downloading package one by one:


C:\Azure\nodeprojects\BlogUsingAzureStorage>npm install express

npm http GET https://registry.npmjs.org/express

npm http 200 https://registry.npmjs.org/express

npm http GET https://registry.npmjs.org/mime

npm http GET https://registry.npmjs.org/qs

npm http GET https://registry.npmjs.org/mkdirp/0.0.7

npm http GET https://registry.npmjs.org/connect

npm http 304 https://registry.npmjs.org/qs

npm http 304 https://registry.npmjs.org/mkdirp/0.0.7

npm http 304 https://registry.npmjs.org/connect

npm http 200 https://registry.npmjs.org/mime

npm http GET https://registry.npmjs.org/formidable

npm http 304 https://registry.npmjs.org/formidable

express@2.5.6 ./node_modules/express

├── mime@1.2.4

├── qs@0.4.0

├── mkdirp@0.0.7

└── connect@1.8.5



C:\Azure\nodeprojects\BlogUsingAzureStorage>npm install ejs

npm http GET https://registry.npmjs.org/ejs

npm http 304 https://registry.npmjs.org/ejs

ejs@0.6.1 ./node_modules/ejs




C:\Azure\nodeprojects\BlogUsingAzureStorage>npm install jade

npm http GET https://registry.npmjs.org/jade

npm http 200 https://registry.npmjs.org/jade

npm http GET https://registry.npmjs.org/mkdirp

npm http GET https://registry.npmjs.org/commander

npm http 304 https://registry.npmjs.org/mkdirp

npm http 304 https://registry.npmjs.org/commander

jade@0.20.0 ./node_modules/jade

├── commander@0.2.1

└── mkdirp@0.3.0




C:\Azure\nodeprojects\BlogUsingAzureStorage>npm install stylus

npm http GET https://registry.npmjs.org/stylus

npm http 304 https://registry.npmjs.org/stylus

npm http GET https://registry.npmjs.org/mkdirp/0.0.7

npm http GET https://registry.npmjs.org/growl/1.1.0

npm http GET https://registry.npmjs.org/cssom/0.2.1

npm http 304 https://registry.npmjs.org/mkdirp/0.0.7

npm http 304 https://registry.npmjs.org/growl/1.1.0

npm http 304 https://registry.npmjs.org/cssom/0.2.1

stylus@0.22.6 ./node_modules/stylus

├── growl@1.1.0

├── mkdirp@0.0.7

└── cssom@0.2.1


C:\Azure\nodeprojects\BlogUsingAzureStorage>npm install azure

npm http GET https://registry.npmjs.org/azure

npm http 304 https://registry.npmjs.org/azure

npm http GET https://registry.npmjs.org/qs

npm http GET https://registry.npmjs.org/mime

npm http GET https://registry.npmjs.org/sax

npm http GET https://registry.npmjs.org/xmlbuilder

npm http GET https://registry.npmjs.org/xml2js

npm http GET https://registry.npmjs.org/log

npm http 304 https://registry.npmjs.org/qs

npm http 304 https://registry.npmjs.org/mime

npm http 304 https://registry.npmjs.org/sax

npm http 304 https://registry.npmjs.org/xmlbuilder

npm http 304 https://registry.npmjs.org/xml2js

npm http 304 https://registry.npmjs.org/log

azure@0.5.1 ./node_modules/azure

├── xmlbuilder@0.3.1

├── mime@1.2.4

├── log@1.2.0

├── qs@0.4.0

├── xml2js@0.1.13

└── sax@0.3.5



C:\Azure\nodeprojects\BlogUsingAzureStorage>npm install node-uuid

npm http GET https://registry.npmjs.org/node-uuid

npm http 200 https://registry.npmjs.org/node-uuid

npm WARN node-uuid@1.3.3 dependencies field should be hash of <name>:<version-range> pairs

node-uuid@1.3.3 ./node_modules/node-uuid


Now if you will look your application node_modules folder you will all the packages are download as below:

C:\Azure\nodeprojects\BlogUsingAzureStorage>dir node_modules

 Volume in drive C has no label.

 Volume Serial Number is 8464-7B7C


 Directory of C:\Azure\nodeprojects\BlogUsingAzureStorage\node_modules


01/25/2012  11:00 PM    <DIR>          .

01/25/2012  11:00 PM    <DIR>          ..

01/25/2012  10:59 PM    <DIR>          .bin

01/25/2012  11:00 PM    <DIR>          azure

01/25/2012  10:58 PM    <DIR>          ejs

01/25/2012  10:57 PM    <DIR>          express

01/25/2012  10:59 PM    <DIR>          jade

01/25/2012  11:00 PM    <DIR>          node-uuid

01/25/2012  10:59 PM    <DIR>          stylus


Now please clone nodeblogwithazurestorage.git repo from GitHub as below:


C:\Azure\nodeprojects\BlogUsingAzureStorage>git clone https://Avkash@github.com/Avkash/nodeblogwithazurestorage.git


Cloning into 'nodeblogwithazurestorage'...

remote: Counting objects: 16, done.

remote: Compressing objects: 100% (14/14), done.

remote: Total 16 (delta 0), reused 16 (delta 0)

Unpacking objects: 100% (16/16), done.


You will see a new folder name “'nodeblogwithazurestorage'” which includes all the files from repo. Please copy all of these files to your root folder so your work folder will look like as below:



01/25/2012  11:25 PM             2,828 blog.js

01/25/2012  11:25 PM    <DIR>          nodeblogwithazurestorage

01/25/2012  11:00 PM    <DIR>          node_modules

01/25/2012  11:25 PM               161 package.json

01/25/2012  11:29 PM    <DIR>          public

01/25/2012  11:29 PM    <DIR>          routes

01/25/2012  11:25 PM             2,073 server.js

01/25/2012  11:29 PM    <DIR>          views


That’s it. Let’s run it.

C:\Azure\nodeprojects\BlogUsingAzureStorage>node server.js

Express server listening on port 40506 in development mode


Now open your browser using http://localhost:40506 or and you will see the node blog application is running as below:


In next blog:

  • We will use Windows Azure Table Storage to store and retrieve Blog articles.
  • Change package.json for correct dependencies
  • Updating package
  • We will deploy this application to Windows Azure
Leave a Comment
  • Please add 7 and 1 and type the answer here:
  • Post
  • It would be more educational if you did it long hand not just using packages.

  • nice1 i really liked it hoping that you will definetely share some more posts like this.

Page 1 of 1 (2 items)