title: How To Deploy NodeJS REST API To AZURE Cloud
body: <p>I'm trying to deploy my nodejs rest api application to my azure cloud, but i fail again and again. </p>
  
  <p>I get HTTP 500 response. </p>
  
  <p>"The page cannot be displayed because an internal server error has occurred."</p>
  
  <p><strong>My AZURE FTP (What I Uploaded) :</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Jjht8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jjht8.png" alt="enter image description here"></a></p>
  
  <p><strong>web.config file</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;system.webServer&gt;
      &lt;webSocket enabled="false" /&gt;
      &lt;handlers&gt;
        &lt;add name="iisnode"
             path="app.js"
             verb="*"
             modules="iisnode"/&gt;
      &lt;/handlers&gt;
      &lt;rewrite&gt;
        &lt;rules&gt;
          &lt;rule name="NodeInspector"
                patternSyntax="ECMAScript"
                stopProcessing="true"&gt;
            &lt;match url="^app.js\/debug[\/]?" /&gt;
          &lt;/rule&gt;
          &lt;rule name="DynamicContent"&gt;
            &lt;conditions&gt;
              &lt;add input="{REQUEST_FILENAME}"
                   matchType="IsFile"
                   negate="True"/&gt;
            &lt;/conditions&gt;
            &lt;action type="Rewrite" url="app.js"/&gt;
          &lt;/rule&gt;
        &lt;/rules&gt;
      &lt;/rewrite&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>URLs</strong></p>
  
  <p><strong>Request</strong> : localhost/api/user/getcategories/5c141fa7498f3605c8b2cf34</p>
  
  <p><strong>Response</strong> : </p>
  
  <pre><code>{
      "success": true,
      "categories": [
          {
              "_id": "5c141fab498f3605c8b2cf35",
              "name": "OTHER"
          }
      ]
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Request</strong> : https://**.azurewebsites.net/api/user/getcategories/5c141fa7498f3605c8b2cf34</p>
  
  <p><strong>Response</strong> : The page cannot be displayed because an internal server error has occurred.</p>