NodeJS plesk主机上的节点项目路由不起作用

l5tcr1uw  于 2023-01-30  发布在  Node.js
关注(0)|答案(1)|浏览(108)

我已经创建了简单的节点应用程序与路由。
启动文件到app.js,然后像这样浏览域:https://api.lemontrade.in/并参见
只有app.js文件是工作,但当我想得到客户与url https://api.lemontrade.in/customers我得到404错误.
HTTP错误404.0 -未找到您要查找的资源已被删除、已更改名称或暂时不可用。

qoefvg9y

qoefvg9y1#

如果您使用的是IIS / Windows主机,您应该将此添加到您的web.config文件中。

<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>

相关问题