In this article we will learn about How to host a JSON API on GitHub Pages.
GitHub Pages is an excellent place to host a site for your portfolio or a project and another helpful use for it is to host JSON API data. We need to create a GitHub Pages repository, put that JSON file in there, and your custom URL will have all of that data. From there you make an API call to your GitHub Pages URL rather than the API server.
Create a new Repository in Github page
Create a GitHub Pages repository, and it should be like username.github.io, where username is your GitHub username. Make sure that it matches your username else it won’t work.
For more details about GitHub pages go through this link https://pages.github.com/.
Once you create the repository it navigate to this screen and you can create a new file or you can clone this and push the file using Git command else you can use also Github Desktop app.
https://corespider.github.io/customer.json
You can use this JSON file anywhere. In below you can see we are use to read json data in ASP.Net.
Summary
Post a Comment