Digitalocean部署的角度设置

发布于 2025-01-23 20:29:41 字数 587 浏览 4 评论 0原文

我正在尝试在Digitalocean上部署Angular App。我从那里的应用菜单创建了应用程序,并说它已经建立了成功。但是当我访问现场网址时,它说无法/(404来自控制台)

“

但是,当我访问我的REST ENDPOINT(API)时,它会很好地打印结果:

意见表明问题似乎可能在路由中?如果是这样,那么我可能需要做的改变才能使它起作用(我还想补充一下本地所有内容都可以按预期工作)。

I am trying to deploy angular app on DigitalOcean. I created application from App menu there and it says that it got built successfuly. But when I visit my live url, it says Cannot get / (404 from console)

Main view

However when I access my REST endpoint (API), then it prints result nicely:

api view

This in my opinion indicates that the problem seems to be maybe in routing? If so, then what changes I might need to do in order to make it work (I would also like to add that locally everything works as expected).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风启觞 2025-01-30 20:29:41

哈哈!问题简直就是关于角dist文件夹。 ng构建将我的东西放入dist/项目名称,但最终我只是从“ outputpath”中更改了“ outputpath”(在angular.json中):“ dist/ project name ”到“ outputpath”:“ dist/”,然后开始工作。

LOL! The issue simply was about Angular dist folder. ng build put my stuff into dist/Project Name, but eventually I simply changed "outputPath" (in angular.json) from "outputPath" : "dist/Project Name" to "outputPath" : "dist/" and it started working then.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文