0

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.

  • Welcome to StackOverflow. Please take a moment and complete the tour: https://stackoverflow.com/tour, read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) and post a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example). Explain your expected behavor and what error occours. Where is your server code, where is your plex/webserver config? – Marc Feb 08 '22 at 12:54
  • Please provide enough code so others can better understand or reproduce the problem. – Community Feb 19 '22 at 14:41
  • This could solve your problem. https://talk.plesk.com/threads/relative-paths-not-functioning-after-porting-to-plesk.361831/ – user3767285 Apr 01 '22 at 08:11

1 Answers1

0

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>