Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature/Apollo] Implement GraphQL-Tools based Schema #1498

Merged
merged 1 commit into from
Jan 13, 2018

Conversation

tim-soft
Copy link

@tim-soft tim-soft commented Jan 9, 2018

Following up on #1443, this is an alternative way to author a GraphQL backend with GraphQL-Tools.

Doing things this way improves on the Apollo branch by:

  1. Greatly simplifying how the API is written, the schema itself is explicitly written in the official schema language
  2. Queries and Resolvers are organized closer together
  3. GraphQL-Tools allows for schema stitching, easily adding in custom scalars such as JSON or file upload types, mocking capabilities and more
  4. Demonstrates better organizational practices than the previous schema

This alternative schema also includes some more usage examples including a mutation, input types, error handling and schema comments.

@langpavel
Copy link
Collaborator

Thanks @tim-soft.
I see there are more lines inserted than removed. Are there new features?

 package.json                                               |   2 ++
 src/core/createApolloClient/createApolloClient.client.js   |   1 -
 src/data/graphql/Database/schema.js                        |  31 +++++++++++++++++++++++++++++++
 src/data/graphql/Database/users/CreateUser.js              |  73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/data/graphql/Database/users/GetAllUsers.js             |  88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/data/graphql/Database/users/GetLoggedInUser.js         |  40 ++++++++++++++++++++++++++++++++++++++++
 src/data/graphql/News/reactjsnews.com/GetAllReactJSNews.js |  75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/data/graphql/News/schema.js                            |  14 ++++++++++++++
 src/data/queries/me.js                                     |  24 ------------------------
 src/data/queries/news.js                                   |  58 ----------------------------------------------------------
 src/data/schema.js                                         | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
 src/data/types/NewsItemType.js                             |  27 ---------------------------
 src/data/types/UserType.js                                 |  25 -------------------------
 src/routes/home/Home.js                                    |   4 ++--
 src/routes/home/index.js                                   |   2 +-
 src/routes/home/news.graphql                               |   4 +++-
 yarn.lock                                                  |  31 ++++++++++++++++++++++++++++++-
 17 files changed, 434 insertions(+), 165 deletions(-)

@tim-soft
Copy link
Author

Yes, I added a few more example queries and a mutation, sync it down and open graphiql. You can query an entire user model with associations

@langpavel langpavel merged commit 9382aa2 into kriasoft:feature/apollo Jan 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants