Angular 7 app getting CORS error from angular client

后端 未结 7 2118
逝去的感伤
逝去的感伤 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:06

    Since, your angular app is running on 4200 port and backend running on 3000 port, the origin of both the application is different.

    To solve this problem, you can setup "nginx" in your machine.

    This will make all your requests from angular and backend, go via "nginx" server. Thus, solving the problem of CORS.

提交回复
热议问题