答案为0的http请求url null ionic 3

时间:2018-11-19 19:43:25

标签: angular http express ionic-framework cors

我的api休息是在本地http://本地主机:3000的nodejs(express)中完成的,我的cors de配置 我的api休息 是

const cors = require('cors')
app.use(cors());

然后在我的离子应用程序中,当我在PC上的浏览器中启动** ionic serce -c **时,所有使用HttpClientModule **的Http请求均起作用 当我已经尝试过 IonicDev App

或者在Android Studios Emulator中出现错误

{“data”: null, “status”: 0, “config”: {“method”: “GET”, “transformRequest”: [null], “transformResponse”: [null], “Accept”: “ application / json ”,“ Content-Type ”:“ application / json ”,“ url ”:“

我也尝试过在ionic.config.json中创建代理** 但我不断抛出同样的错误

"proxies": [
  {
    "path": "/api",
    "proxyUrl": "http://aqui.com/api"
  }
]

0 个答案:

没有答案