简体   繁体   English

通过 http-server 在 Node JS(express)服务器中部署 Angular 应用程序

[英]Deploying an Angular App in Node JS (express) server through http-server

I'm trying to put an angular application in "production" on a local server that is generated by the http-server tool, but it does not return the of the index.html.我正在尝试将一个 angular 应用程序放在由 http-server 工具生成的本地服务器上的“生产”中,但它不返回 index.html 的 。

I followed these steps ...我按照这些步骤...

  1. ng build --prod (this throws me the project folder for production like this -> "dist / project-erp") ng build --prod(这会给我这样的生产项目文件夹 - >“dist / project-erp”) 第1步

  2. http-server http服务器第2步

  3. web server网络服务器第 3 步

Update: So, I changed the base route to "/" but still happening in same situation :/更新:所以,我将基本路线更改为“/”,但仍然发生在相同的情况下:/ 更新 1

更新 1.1

经过多次构建项目的测试,在 Express 服务器上启动它的解决方案(它现在有效)是只执行命令“ng build”而不是“ng build --prod”,然后是文件夹“dist / project -erp“将它们放在后端服务器上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM