Use Javascript to get the list of a user's Github repositories

后端 未结 4 1831
迷失自我
迷失自我 2021-02-04 19:58

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

4条回答
  •  遥遥无期
    2021-02-04 21:05

    http://developer.github.com/v3/ is pretty explicit on how to do this. In fact, since my username there and here are the same, let me show you.

    I opened my repo page on github, https://github.com/jcolebrand (so this is evident so far) and pressed F12 in Chrome.

    I interrogated to see that jQuery is indeed installed, because I like shortcuts when I'm doing examples.

    I then tested $.getJSON('//api.github.com/users/jcolebrand/repos',{},function(data){console.log(data)}) exactly from the API page, as it says, and lo and behold, I was granted the five repos I see for myself.

    Here are the things I have not done: I did not acquire an API key, I did not work via API, and I used my existing credentials. Keep those things in mind, but that's how to improve it going forward.

提交回复
热议问题