当我尝试从我的Angular 2 App到我的API进行API调用时,我收到以下错误:
XMLHttpRequest cannot load http://localhost/myAPI/public/api/v1/auth/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 422.
Run Code Online (Sandbox Code Playgroud)
我一直在检查网络上的每一个问题和任何与CORS相关的问题,没有解决我的问题!
我的Laravel API在端口80上运行.(localhost)
我的角度2应用程序在端口3000上运行.(localhost:3000)
那么......怎么了?为什么我的Angular 2应用程序无法从我的API获取记录?