简体   繁体   中英

Using Graphql and Github API to get repository information

I'm new to web development and I'm trying to make a portfolio website for myself. At the moment I'm trying to stay as vanilla as possible. On my homepage I want to grab information from the repository that I last committed to, title, description, commit history, etc. So that anyone who visits my site can see my latest project.

I've learned that you can use graphql to interact with the github API to grab this information, and that you can use a simple HTTP request in JavaScript using the fetch function to send a query. My confusion comes in when you start involving authentication tokens and once I have one how to keep it private instead of hard coding it into my website code.

If anyone can explain, it'd be much appreciated

If you confused about how to do that, I suggest taking a look at the example at https://graphql.org/graphql-js/passing-arguments/

If you want to try the GraphQL queries/mutations out yourself, you can try at https://developer.github.com/v4/explorer/

Without knowing what you already tried this is all I can offer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM