canmustu
canmustu

Reputation: 2649

How To Deploy NodeJS REST API To AZURE Cloud

I'm trying to deploy my nodejs rest api application to my azure cloud, but i fail again and again.

I get HTTP 500 response.

"The page cannot be displayed because an internal server error has occurred."

My AZURE FTP (What I Uploaded) :

enter image description here

web.config file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <webSocket enabled="false" />
    <handlers>
      <add name="iisnode"
           path="app.js"
           verb="*"
           modules="iisnode"/>
    </handlers>
    <rewrite>
      <rules>
        <rule name="NodeInspector"
              patternSyntax="ECMAScript"
              stopProcessing="true">
          <match url="^app.js\/debug[\/]?" />
        </rule>
        <rule name="DynamicContent">
          <conditions>
            <add input="{REQUEST_FILENAME}"
                 matchType="IsFile"
                 negate="True"/>
          </conditions>
          <action type="Rewrite" url="app.js"/>
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

URLs

Request : localhost/api/user/getcategories/5c141fa7498f3605c8b2cf34

Response :

{
    "success": true,
    "categories": [
        {
            "_id": "5c141fab498f3605c8b2cf35",
            "name": "OTHER"
        }
    ]
}

Request : https://**.azurewebsites.net/api/user/getcategories/5c141fa7498f3605c8b2cf34

Response : The page cannot be displayed because an internal server error has occurred.

Upvotes: 0

Views: 906

Answers (1)

timothytavarez
timothytavarez

Reputation: 11

If you access your Azure App Service pane for the web app, under Development Tools you should have a "Advanced Tools". Select it and then hit "go" to access Kudu.

Kudu Advanced Tools Screenshot

You can then go to the "Debug Console" dropdown to access your preferred shell. From here you should be able to access the server logs and see what errors are being thrown.

Upvotes: 1

Related Questions