Joining the dots….

I did some work a while ago regarding sockets using Node.js which can be seen here.

I have also been doing some work on Angular consuming WebAPI through .NET MVC and SQL Server.

I decided that I would go the whole hog and create a test piece that ties the following together.

Node.js running ExpressJS and Jade templating.

The served up pages are going to be managed by Angular and all the data is initially going to be handles through MongoDB although i may have ot switch this out to MS Table storage when i put this on the Azure platform.

The git repo is here if you are interested and the live azure site is here.

I shall post more about it when I have time.

— Update —

One little annoyance was that express aotumatically creates a www folder in the bin directory which Azure has real issues with so that took a little while to solve. It was simply a case of creating a web.config file which forces iis to use the bin directory.

The code is below if you are interested.

<?xml version="1.0" encoding="utf-8"?>

By default IIS will block requests going to the bin directory for security reasons.
We need to disable this since that's where Express has put the application entry point.
<remove segment="bin" />

<!-- Indicates that the www file is a node.js entry point -->
<add name="iisnode" path="/bin/www" verb="*" modules="iisnode"/>
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^bin\/www\/debug[\/]?" />

First we consider whether the incoming URL matches a physical file in the /public folder.
This means IIS will handle your static resources, and you don't have to use express.static
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>

<!-- All other URLs are mapped to the node.js entry point -->
<rule name="DynamicContent">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
<action type="Rewrite" url="/bin/www"/>
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: