Free API - Inspirational quotes JSON with code examples

Thanks for taking a look at this!

I am wondering if the response header needed is the one below:
Access-Control-Allow-Origin: *

Reviewing the documentation for Access-Control-Allow-Headers, the header responds to a browser’s pre-flight request (which includes a Access-Control-Request-Headers header from the client-side).

My hypothesis is that that may not be directly related to the issue at hand. It seems that addition of the Access-Control-Allow-Origin: * response header would solve the CORS issue as it would allow calls from any origin instead of just http://type.fit.

Sorry for bugging you on this! This is first time I am running into a CORS issue so I have been forced to finally learn it, which is fantastic.

Having the same issue as ab91. I’m also a novice with these things but I thought I’d chime in anyway. I’ll be following along :slight_smile:
Question, I’m working with my app on “localhost”, would this cause the issue since perhaps my localhost server isn’t permitted to access the url?

Hi, I was also using this API and it stopped working due to the CORS issue. This is such a cool API, thanks for building it! I hope you can get it up and running again. We appreciate it so much.

Thank you for sharing this API. Very useful for learning :slight_smile:

@calebwaldner, @ab91, @lemonhippo, @ryfan thanks for your feedback.
The CORS issue has been fixed for sure.

Please check the demo repository with a simple React app using the API: https://github.com/ssokurenko/quotes-react-app and live demo : https://quotes-react.netlify.app

2 Likes

That is a killer update! Thanks for your work. I temporarily am using another service for this, but the quotes are not as good. I’ll revert to yours in a bit, I see the more permissive header is in there now.

2 Likes

Thanks for helping , I hope i will make this for my website.

1 Like

Bless your soul. This is EXACTLY what I needed.

1 Like

Thanks for kind words, man.
Please share a usage example when available.

Hi ,thanks a lot for the API .I wanted to know that can i use it in my production website i have already created a simple website link: https://hasbeenquoted.herokuapp.com/ . Thanks again really appreciate your help.

1 Like

Hi @AbhishekGaikwad, sure, you’re welcome to use the API!
Nice app design and implementation!

Awesome @SergeyWebPro !!
This was what I was looking for.
Neat & tidy, :smiley: great job.
Thanks for sharing.

1 Like

Hi @SergeWebPro I’m trying to limit the return value by passing a limit query to the URL but it still returns all the data. Pls how do I solve this.

This is my code I use axios.

axios.get('https://type.fit/api/quotes?_limit=100')
    .then(res => console.log(res))
    .catch(err => console.error(err));
2 Likes