Access to XMLHttpRequest has been blocked by CORS policy

后端 未结 7 1772
-上瘾入骨i
-上瘾入骨i 2021-02-18 16:58

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条回答
  •  旧时难觅i
    2021-02-18 17:12

    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

提交回复
热议问题