yomomma-apiv2
yomomma-apiv2 copied to clipboard
CORS error while fetching data from the api
I am getting this error while trying to fetch from the api via axios
Access to XMLHttpRequest at 'http://yomomma-api.herokuapp.com/jokes' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I did get a workaround by installing an extension but that's not a global solution.
Please solve this. I searched on the internet and it seems
headers: { "Access-Control-Allow-Origin": true, },
can solve the issue
I've created a sample project and its hosted here, you can check it https://yomamma.netlify.app/