将节点 js 后端部署到共享主机

Deploying a node js backend to a shared hosting

我正在尝试使用 cPanel 在我的共享托管服务上部署应用程序。

我的提供商在面板中有经典的 'setup node js app',我用它在 mywebsite 路径下激活我的应用程序。com/api。

我还使用以下 .htaccess

在 public_html 下托管了我的 Angular 前端
<IfModule mod_rewrite.c>
  DirectoryIndex disabled  
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]
</IfModule>

我的前端应用程序可以工作,但是当我尝试向我的后端发送 POST 请求时,即 (mywebsite/api/login) 它 returns html 前端作为响应。

这是什么 returns :

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>my frontend app</title>
    <base href="./">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/x-icon" href="assets/favicon.ico">
</head>
<body>
    <app-root></app-root>
    <script src="runtime-es2015.js" type="module"></script>
    <script src="runtime-es5.js" nomodule defer></script>
    <script src="polyfills-es5.js" nomodule defer></script>
    <script src="polyfills-es2015.js" type="module"></script>
    <script src="styles-es2015.js" type="module"></script>
    <script src="styles-es5.js" nomodule defer></script>
    <script src="scripts.js" defer></script>
    <script src="vendor-es2015.js" type="module"></script>
    <script src="vendor-es5.js" nomodule defer></script>
    <script src="main-es2015.js" type="module"></script>
    <script src="main-es5.js" nomodule defer></script>
</body>

</html>

我错过了什么吗?

顺便说一句:

当我从我的网站访问我的后端时。com/api 我得到这个 :

解决方案是在端口 50000 上托管节点 js 应用程序,这样我就可以从前端轻松地联系它。而不是在 cpanel 中使用经典的设置节点 js 应用程序。