Angular 7 app getting CORS error from angular client

后端 未结 7 2120
逝去的感伤
逝去的感伤 2020-12-15 21:36

I have developed an angular 7 app with express backend. Express running on localhost:3000 and angular client is running on localhost:4200.

In the

相关标签:
7条回答
  • 2020-12-15 22:26

    I know this is already answered, but it might help someone who is searching for CORS issue. You can follow below 3 steps to solve this issue. 1. Create proxy.conf.json file and put it at root level of your app. 2. In package.json file, add proxy parameter in ngstart 3. In angular.json, add proxy file entry. 4. Change all your rest calls to something like /api/getData.

    Complete step by step tutorial is given here. http://www.codeyourthought.com/angular/proxy-to-make-http-call-in-angular/

    0 讨论(0)
提交回复
热议问题