I am to dum to know how to ping this API

I want to have a discord and Roblox member count on my website, is there a way to do that keeping it a static site? The API is Groups Api I don’t know how to reference it in my code
Any help would be helpful

I’m not an expert but I fear you won’t be able to get the data you want from a static site because of CORS policy

I tried this code from a static site

fetch("https://groups.roblox.com/v2/groups")
.then(data => console.log(data)
.catch(err => console.error(err)

and got the dreaded response :

Access to fetch at 'https://groups.roblox.com/v2/groups' from origin 'http://localhost:3000' has been blocked by CORS policy: ... blablabla

the site you want to get data from does not seem to send the famous header Access-Control-Allow-Origin that would allow you to fetch the data from a static website.

A server would not have this problem though

1 Like

The website runs thru an external server would it still play the glitch loading if I had DNS refer on?

… sorry I don’t get what you mean, your website has a server ? then you could fetch the roblox site using node-fetch package.

& about glitch loading, since there is a server, and if you did not pay glitch and boost your app, it will sleep so you will have glitch loading anytime it wakes up I believe … did i get it ?

1 Like

the only solution to avoid glitch loading and fetch data from a server would be to host your server somewhere else than glitch (heroku does not sleep for example) and redirect your data with the CORS policy enabled, to your static site wich would be always up. That’s a bit of work but that’s what I am doing with my own website (but using glitch to host the server, i don’t care for it to sleep)

Well, I dont think you are the only one couldnt do that. I tried but I couldnt do that too :open_mouth:

I mean we have a web server, we are storing the code on glitch but hosting off of a private server (server may or may not have been cooked in a fire)

OVH server in Strasbourg ? fingers crossed for you :crossed_fingers:

1 Like

If you were/are on OVH I’m quite sure they did take some sort of backups.