Disini akan digunakan beberapa tools
Download git-scm dari https://git-scm.com/downloads
to get ssh key in your computer, and put in your github or gitlab ssh key setting.
cat ~/.ssh/id_rsa.pub
if there is no key appears, plese generate the key also set global config of git in next section and please add the public key to your github profile.
Just One time for first instalation of git scm,
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Just One time for first instalation of git scm,
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
Untuk membuat antarmuka menggunakan komponen tailwind contoh :https://tailwindcomponents.com/component/multi-line-table
lakukan download. fork repo ini. kemudian open with code. taruh file htmlnya di folder di dalam folder site
fork repo
lakukan clone repo yang di fork
install plugin live server
<script src="./croot.js"></script>
Buka dengan live server, inspect lihat di console.
var myHeaders = new Headers();
myHeaders.append("Cookie", "connect.sid=s%3AMsnp_KW3uPWTf6gN4GDNl7XAoOShdRL2.VK05aaDbN1FeG%2BScGHtOuxENv5s2ABoZZzLpqN%2FUbZs");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
hasil=""
fetch("https://cat-fact.herokuapp.com/facts", requestOptions)
.then(response => response.text())
.then(result => tampilkan(result))
.catch(error => console.log('error', error));
function tampilkan(result){
console.log(result);
hasil=JSON.parse(result);
//document.getElementById("nama").innerHTML(result);
}
akan terlihat variabel hasil di console log
untuk akses variabel global hasil kita pakai console log
kemudian tambahkan ramuan looping untuk mengeluarkan semuanya