First of all, thanks for reading.
I am hosting my current projects on GitHub. Using GitHub Pages, I ]host my personal blog, you can reach the blog here.
On the b
Extending to @JColebrand's answer with the JQuery
shortcut to XMLHttpRequest
, $.getJson()
, here is an API Call that works in 2020.
user = 'tik9'
apirepo = `https://api.github.com/users/${user}`
listrepos = document.createElement('ul')
document.getElementById('github').appendChild(listrepos)
$.getJSON(apirepo + '/repos', function (data) {
console.log('data now', data)
function compare(a, b) {
if (a.watchers > b.watchers) {
return -1
}
if (a.watchers < b.watchers) {
return 1
}
return 0
}
data.sort(compare)
data.forEach(v => {
listItemRepo = document.createElement('li')
listrepos.appendChild(listItemRepo)
hlink = document.createElement('a')
listItemRepo.appendChild(hlink)
hlink.textContent = `${v.description} | Stars: ${v.watchers}`
hlink.href = v.html_url
})
})
Github Repositories