yomomma-apiv2 icon indicating copy to clipboard operation
yomomma-apiv2 copied to clipboard

CORS error while fetching data from the api

Open thecurious1-sudo opened this issue 2 years ago • 0 comments

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 image I've created a sample project and its hosted here, you can check it https://yomamma.netlify.app/

thecurious1-sudo avatar Oct 23 '22 09:10 thecurious1-sudo