loading...

Github gist + Github pages

abhishekcode profile image Abhishek Singh ・1 min read

I host my personal website on Github pages, Every time whenever I wanted to update website I had to update code, because data was part of repo.

Recently I learned that we can access gist by api, So now I am hosting my data on gists and loading it dynamically with API call. Which is pretty cool.

Without Database and backend now I can update website anytime without actually updating code.

Here is sample code

let url ="https://api.github.com/gists/9052ef9a070e0d5ab046fa3464d026c4";
fetch(url).then(response => {
   response.json().then(data => {
     let profileData =JSON.parse(data.files["personalData.json"].content)
   })
 })

Discussion

pic
Editor guide