Appearance
仓库
查询仓库列表。
const TOKEN = '123456';
const url = 'https://api.cnb.cool/user/repos';
const options = {method: 'GET', headers: {Authorization: 'Bearer ' + TOKEN}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}查询仓库信息。
const TOKEN = '123456';
const NAME = 'yourname/mygit';
const url = `https://api.cnb.cool/${NAME}`;
const options = {method: 'GET', headers: {Authorization: 'Bearer ' + TOKEN}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}