看文档
proxy.conf.json
{ ?"/api": { ???"target": "http://localhost:5000", ???"secure": false, ???"pathRewrite": { ?????"^/api": "" ???} ?}}
使用
?ngOnInit() { ???this.msg$ = this.http.get("/api/ng7", { ?????responseType: "text", ???}); ?}
后台代码片段
@Controller()export class AppController { ?@Get('ng7') ?ng7(): string { ???return 'hello ng7'; ?}}
ng7 设置http proxy
原文地址:https://www.cnblogs.com/ajanuw/p/10227549.html