api - Serve JSON Data from Github Pages -
i have repository on github contains number of csv, json, yml data files in root directory of repository.
how serve files using github pages?
so eg: when go http://username.github.io/reponame/
followed by
/posts
- serve contents of posts.json file/users
- serve contents of users.json file/comments
- serve contents of comments.json file/posts.csv
- serve contents of posts.csv file
you need add .json
files in repository , can access them normal json api
in following repository username.github.io/reponame
add following files
posts.json
[ {"id": 1, "title": "title 1"}, {"id": 2, "title": "title 2"} ]
users.json
[ {"name": "abc", "email": "abc@example.com"}, {"name": "xyz", "email": "xyz@example.com"} ]
comments.json
[ {"post_id": "1", "text": "comment 1"}, {"post_id": "2", "text": "comment 2"} ]
posts.csv
id,title 1,title 1 2,title 2
and access them
http://username.github.io/reponame/posts.json
http://username.github.io/reponame/users.json
http://username.github.io/reponame/comments.json
http://username.github.io/reponame/posts.csv
Comments
Post a Comment