An open API service indexing awesome lists of open source software.

https://github.com/danimal141/learning-graphql-ts

This project builds a sample GraphQL application to learn "Learning GraphQL".
https://github.com/danimal141/learning-graphql-ts

create-react-app graphql graphql-code-generator reactjs type-graphql typeorm typescript

Last synced: 6 months ago
JSON representation

This project builds a sample GraphQL application to learn "Learning GraphQL".

Awesome Lists containing this project

README

          

# learning-graphql-ts

This project builds a sample GraphQL application to learn [this book](https://www.oreilly.com/library/view/learning-graphql/9781492030706/).

Different from [the original](https://github.com/MoonHighway/learning-graphql), this project uses TypeScript, MySQL, typeorm and type-graphql.

## How to develop

```
// setup
$ yarn
$ docker-compose up

// run all
// Server: you can open `http://localhost:4000/playground` and `server/schema.gql` would be automatically generated / updated
// Client: you can open `http://localhost:3000` and `client/graphql/generated.tsx` would be automatically generated / updated
$ yarn dev
```

## How to get a GitHub Token

- Create an OAuth app [here](https://github.com/settings/developers).
- Access: http://github.com/login/authorize?client_id=xxx&scope=user
- Then you would redirect to `http://localhost:4000?code=xxx`
- You can use the code like:

```
mutation {
githubAuth(code: "xxx") {
token
user {
githubLogin
name
avatar
}
}
}
```

- Then you can use the token like `{ "Authorization": }` on the http headers.