Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erikwittern/graphql-demo
Example GraphQL app that renders latest issues and issue comments for a given GitHub repository.
https://github.com/erikwittern/graphql-demo
Last synced: 6 days ago
JSON representation
Example GraphQL app that renders latest issues and issue comments for a given GitHub repository.
- Host: GitHub
- URL: https://github.com/erikwittern/graphql-demo
- Owner: ErikWittern
- License: mit
- Created: 2020-05-16T15:47:27.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T18:14:36.000Z (almost 2 years ago)
- Last Synced: 2024-10-06T01:21:40.095Z (3 months ago)
- Language: TypeScript
- Size: 1.15 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub PRs & Comments
Example GraphQL app that renders latest pull requests and their first comments for a given GitHub repository. The purpose of this app is to contrast the use of GitHub's [REST API v3](https://developer.github.com/v3/) vs. its [GraphQL API v4](https://developer.github.com/v4/). Written in [TypeScript](https://www.typescriptlang.org/), uses the [React](https://reactjs.org/) UI library and [Tailwind CSS](https://tailwindcss.com/) for styling.## Providing an access token
To use either of GitHub's APIs, a personal access token is required. GitHub provides [instructions on how to create access tokens](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line).To make the token available to this app, create a file `src/token.ts` with the following content:
```javascript
export const token = ''
```## Building and running
After cloning this repository, install dependencies:```
npm i
```To then compile the TypeScript code into JavaScript and start the development server:
```
npm run dev
```## Switching between REST and GraphQL
The code in `fetchREST.ts` and `fetchGraphQL.ts` is responsible for fetching required data from GitHub's REST and respectively GraphQL APIs. This code is invoked from the `fetchData` function in `App.tsx`. Comment in the desired function.## License
MIT