GitHub JSON Server

Introduction

Recently, I would like to serve some JSON files that are being updated routinely in GitHub repository so that they can be retrieved by HTTP requests.

However, after uploading the GitHub JSON files to the GitHub repository, I found that GitHub will attach a token string, such as token=GHSAT0AAAAAABH4P5FAZ5Z7T45EG64MBT2IYTMX4EQ to the JSON URL. The token string will also be updated if the GitHub JSON file gets updated. Since the URL will “randomly” change, it is not friendly to HTTP requests.

Variable JSON URL in GitHub Repository

In this blog post, I would like to show to how to serve JSON file using constant URL on GitHub.

GitHub Page Serving JSON

It turns out that if we turn on the GitHub Page for the repository, the JSON URL will be a constant.

Constant JSON URL on GitHub Page

To turn on GitHub Page for the repository, simply to go the repository settings.

Turn on Repository GitHub Page

References

Author

Lei Mao

Posted on

05-13-2022

Updated on

05-13-2022

Licensed under


Comments