{ "/api/*": { "target": "http://localhost:3000", "secure": false, "pathRewrite": { "^/api": "" }, "changeOrigin": true } }
"start": "ng serve --proxy-config proxy.conf.json"
this.httpClient.get('/api/data').subscribe(data => { console.log(data); });
这将会在 http://localhost:4200/api/data 上发出 HTTP 请求,并将响应包含在订阅的回调函数中。