【问题标题】:Ionic 2 client files on one port, API endpoints on different port一个端口上的 Ionic 2 客户端文件,不同端口上的 API 端点
【发布时间】:2017-01-05 21:48:59
【问题描述】:

我在端口 1512 上设置了一个 ASP.NET Core 服务器,并且我的 Ionic 2 开发服务器在端口 1513 上运行。我希望能够打开 localhost:1513,以便获得开发的实时重载功能服务器,但是当我的 api 请求被调用时,我希望它们使用端口 1512,以便它们从后端服务器检索。

我仅使用 webpack 和 angular 进行了此设置,但使用 Ionic 2 我正在努力使其正常工作。

【问题讨论】:

  • 你的 api 调用如何?您只需在拨打电话时使用正确的端口即可。
  • this.http.get("api/account/userinfo")

标签: webpack ionic2


【解决方案1】:

检查this answer 和问题的cmets。

对于本地开发,可以更改

this.user = this.http.get("api/account/userinfo")

进入

this.user = this.http.get("localhost:1512/api/account/userinfo")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-22
    • 2011-12-15
    • 1970-01-01
    • 1970-01-01
    • 2014-08-04
    • 2021-06-16
    • 1970-01-01
    相关资源
    最近更新 更多