Access to XMLHttpRequest has been blocked by CORS policy

后端 未结 7 1733
-上瘾入骨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条回答
  •  野性不改
    2021-02-18 17:02

    There are two ways this can be handled:

    1. Temporary Front-End solution so you can test if your API integration is working:

    Click on window -> type run and hit enter -> in the command window copy:

    chrome.exe --user-data-dir="C://Chrome dev session" --disable-web-security

    This will open a new "Chrome" window where you can work easily. This is a temporary solution. Every time you will have to work with this chrome window.

    1. Permanent solution:

    In the backend code, the developer needs to add an annotation @Crossorigin right above the CRUD api call method.

    Let me know if it works.

提交回复
热议问题