Access to XMLHttpRequest has been blocked by CORS policy

后端 未结 7 2277
庸人自扰
庸人自扰 2021-02-18 16:49

I\'ve a problem when I try to do PATCH request in an angular 7 web application. In my backend I have:

app.use((re         


        
7条回答
  •  自闭症患者
    2021-02-18 17:05

    This problem is not on your frontend angular code it is related to backend,

    Try below steps in your backend code :

    1.npm install cors

    2.put app.use(cors()) in main express route file.(enables all CORS requests)

    may be it works for you.

    reference link : https://expressjs.com/en/resources/middleware/cors.html

提交回复
热议问题