I'm doing technical test for some company and I created github api token and used in fetch function(headers : Authorization) , because without it I exceeded fetch limit(20-30 calls in minute), now I have to push my project in github and what should I to token? I know that's it's personal, but without it website crashes if user calls fetch more than 20-30 times in minute, what should I do?
const getPoPularProfile = async () => {
const api_url = 'https://api.github.com/search/users?q=repos:%3E800+followers:%3E1000&page=1&per_page=10';
const fetchProfile = await fetch(api_url,{
headers: {
Authorization: `token my token `
}
});
const profile = await fetchProfile.json();
setProfiles(profile.items);
}
so thats code, it gets called every time user types something in search bar, i know github api limit is like thousands in hour, but if you aren't calling fetch in same intervals, its like 10-15 calls per minute, and 20-30 call per minute if using github token, so thats why i am using token and setTimeout function to avoid calling fetch more then 20 times per minute.
if(searchValue !== ''){
setShow(true);
setSpinner(true);
const timer = setTimeout(() => {
getSearchedProfile(searchValue);
}, 2200);
return () => clearTimeout(timer);
}
and if won't push token with project and someone clones my code from github, and hosts it, site will crash because for exceeded limits.