I builded the project in React but Ihad a lot of problems with the API connection to get quotes, first I had a CORB problem, and then I changed the API endpoint and got the following message in the Google console:
Failed to load resource: net::ERR_CERT_COMMON_NAME_INVALID
App.js:45 error is TypeError: Failed to fetch
Here is my project : https://github.com/Natcancein/FreeCodeCamp/tree/master/FrontEndLibrariesProjects/build-random-quote-machine
and here is published:
thanks, I have tried a lot of api websites, but I have not any lucky .
Besides, when I try in local works fine (npm start), but when I deploy in gh-pages the problems appears.
Github pages have SSL certificate and your API endpoint doesn’t have one, that’s why it gives the error.
And it works locally because you wouldn’t have any SSL certificate on localhost.
You will need to use an API that allows CORS and have a valid SSL certificate.
If that sounds a lot of work to find to signup for the APIs or you couldn’t find any free API, just use the following link to get all the quotes in one go and use them:
Or you can create your custom quotes JSON file and upload it to Github and use it.