Configuring the client proxy -- Angular App --> CLI dev server -- >Rest Server

 

 In Dev mode,

1 你想利用CLI的Hot reload features 和快速Rebuild application bundles in memory.

2.和发请求给Rest Server.
那么,你需要配置代理来来改善你的开发体验。

实现步骤:
1.新建 proxy-conf.json
{

"/api": {
      "target": "http://localhost:8000",               -- redirect requests to you rest server.
      "secure": false                                         -- v>The target connection doesn’t need SSL certificates.
      }
}
2. Change scripts to add your command scripts.

 

3.npm run dev

 



posted @ 2021-06-12 10:15  zjf2018  阅读(38)  评论(0)    收藏  举报