using github gist as a cms

1 min read  •  16 Jun 2024
Views:

Many times, we need a very basic cms for our hobby projects. For those cases, we can use github gist to have it.


Steps:

  1. We need to create a public gist, with a json file having our config data create-config-gist

  2. Once the gist is create, grab the gist id gist-id

  3. Then, we can simply fetch its content by following url. The config data would be present at response.files['your-file-name'].content.
    In our case it would be response.files[data.json].content

API: https://api.github.com/gists/<your-gist-id-here>
Example:  https://api.github.com/gists/88c72cf2e8ba532a24024d9cfa5cc52a
  1. Once we get the stringified json, we can parse it and use it.

Video Tutorial