Azure Web App with AngularJs and NodeJs Apps on Same Instance

3 minute read | By prmadi

In my previous Blog, I have wrote on hosting AngularJs app in Azure Web App. This post would provide details on how to host AngularJs App on a web app instance aside of NodeJs App.

 Code available on github @

1) Install express-generator at global level, we would use this to create express(nodeJs web framework) templates.

npm install -g express-generator

2) Use express cli to create a express template app

express .

3) Install required modules using below command

npm install


4) Use below command to start the app on local server and check if template app is working on local environment.

npm start

5) Move your code to azure web app after adding below web.config file at root folder

    <?xml version="1.0" encoding="utf-8"?>
    This configuration file is required if iisnode is used to run node processes behind
    IIS or IIS Express. For more information, visit:
    <!-- Visit for more information on WebSocket support -->
    <webSocket enabled="false" />
    <!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
    <add name="iisnode" path="bin/www" verb="*" modules="iisnode"/>
    <!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
    <rule name="StaticContent">
    <action type="Rewrite" url="public{REQUEST_URI}"/>
    <!-- All other URLs are mapped to the node.js site entry point -->
    <rule name="DynamicContent">
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
    <action type="Rewrite" url="bin/www"/>
    <!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
    <remove segment="bin"/>
    <!-- Make sure error responses are left untouched -->
    <httpErrors existingResponse="PassThrough" />
    You can control how Node is hosted within IIS using the following options:
    * watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
    * node_env: will be propagated to node as NODE_ENV environment variable
    * debuggingEnabled - controls whether the built-in debugger is enabled
    See for a full list of options
    <!--<iisnode watchedFiles="web.config;*.js"/>-->

6) Check if your app is still working on azure.

7) Change app.js file at root folder to set appropriate routes as below. Order of below routes is important (all the url’s except for /users are getting routed to index.js/jade file which would load AngularJS Code)

app.use('/users', users);
app.use('/*', routes);

8)  Change views/index.jade file to below content. [Red] part is to add ng-app div, [Blue] part is to add required AngularJs files, [Green] part would be used to insert templates based on incoming url.

      extends layout

      block content
           h1= title
           a(href='/donarlist') Donar lists
           a(href='/receivertrans') Receivers

9) Add required Templates and AngularJs files in public folder @

10) For more details on individual templates/JS files, please refer

11) Below are final output screenshots

- Web App serving Node.js content at ‘/users’ url

- Web App serving AngularJs content in all other url’s