Pool-Of-Tears / SuperHero-Quotes

Restful JSON API consisting huge collection of Marvel & DC SuperHeros and Supervillains quotes!

Home Page:https://superhero-quotes.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facing CORS Policy issue

jasmin-merchant opened this issue · comments

Hey there!

I love the concept, and the quotes collection is really amazing!

I am building something similar on top of it & was thinking to use the API to get the quotes. However, when I'm using the endpoints in Postman, I'm able to get the response but have been unsuccessful to get any response when trying via JavaScript. It's giving CORS policy issue.

Can you please check or let me know a way to get the data?

Here's a sample code that you could try from any file or Chrome dev tools. Any help would be greatly appreciated!!

fetch("https://akabab.github.io/superhero-api/api/all.json")
.then(response => console.log(response))
.catch(error => console.log('error', error));

Here's a reference of the issue showing:

Screenshot 2022-01-08 at 6 10 09 PM

Hi thanks for your kind feedback! i've tried to fix the problem from API side, can you please try again?

Hey thank you so much for acting on it promptly, it worked wonderfully!!! I've updated from my end & now it's loading perfectly.

Btw if you want to check it out, here's the link to it:

https://comiquotes.gatsbyjs.io

Hey thank you so much for acting on it promptly, it worked wonderfully!!! I've updated from my end & now it's loading perfectly.

Btw if you want to check it out, here's the link to it:

https://comiquotes.gatsbyjs.io

Glad to hear that! And really cool work (^^) nice to see people building stuffs on the API!