node project routing not working on plesk hosting

594 Views Asked by At

I have created simple node application with routing.

Startup File to app.js and after browsing the domain like this :https://api.lemontrade.in/ and see

only app.js file is working but when I want get customers with url https://api.lemontrade.in/customers I am getting 404 error.

HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

1

There are 1 best solutions below

0
Md Rezaul Karim Reza Khan On

You should add this in your web.config file if you are using IIS / Windows hosting.

<configuration>
      <system.webServer>
        <handlers>
          <add name="iisnode" path="app.js" verb="*" modules="iisnode" />
        </handlers>
    
        <rewrite>
          <rules>
            <rule name="myapp">
            <match url="/*" />
            <action type="Rewrite" url="app.js" />
          </rule>
    <!-- Don't interfere with requests for node-inspector debugging -->
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
           <match url="^app.js\/debug[\/]?" />
        </rule>    
      </rules>   
    </rewrite>  
  </system.webServer>
 </configuration>