Recently I have been developing a React website and wanted to include a simple counter API to display the number of visits to the website.
After watching some tutorial videos for this API: https://countapi.xyz/ , the instructions said that I need to generate a namespace and key for my website using the following link:
https://api.countapi.xyz/create?namespace={name of your website}&enable_reset=1
It is mentioned that the name of the website can be anything you want it to be.
If I edit this link to feature the name of my website, it does not load. The result should look like this:
This is the tutorial video I used: https://www.youtube.com/watch?v=WTHrtiMEjk0&t
The comment section suggests that a change was made around 4 months ago to how the API works, but I am unable to find any mention of this
Furthermore, when I visit the API website, it seems broken as if the API isnt working for them either:
When inspecting i found this:
I managed to use this code on their website and also received the same CORS error:
import countapi from 'countapi-js';
countapi.visits().then((result) => {
console.log(result.value);
});
I have never heard of CORS but from what I understand after some research is that it is blocking my access to the backend server...
I was wondering if this is an issue on my end, and have no clue on how to go about solving this. One solution I found was for if you actually own the server which is blocking you, but obviously I dont think thats the case here... I should mention I am not hosting my website currently, I am running it from localhost, but others have also done this and it worked for them in the tutorials.