-
Notifications
You must be signed in to change notification settings - Fork 146
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
Add steps to add custom resolver to README #16
Conversation
Closes #15 Please let me know if any changes are needed.
README.md
Outdated
@@ -69,6 +69,33 @@ yarn playground | |||
- [`/src/index.ts`](https://github.com/graphcool/graphql-boilerplate/blob/master/src/index.ts) is the entry point of your application, pulling everything together and starting the [`graphql-yoga`](https://github.com/graphcool/graphql-yoga) Server. | |||
- [`/src/resolvers/`](https://github.com/graphcool/graphql-boilerplate/tree/master/src/resolvers) includes the actual business logic of your application. In GraphQL you implement [resolvers](http://graphql.org/learn/execution/) that *resolve* a specific query being requested | |||
|
|||
### Next Steps | |||
#### Adding a custom resolver | |||
Suppose we want to add a custom resolver to delete a post (example). We can take the following steps:- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer
Suppose we want to add a custom resolver to delete a post. We can take the following steps:
README.md
Outdated
#### Adding a custom resolver | ||
Suppose we want to add a custom resolver to delete a post (example). We can take the following steps:- | ||
|
||
Add `delete` field to the Mutation type in `src/schema.graphql` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer
Add a new
delete
field to the Mutation type insrc/schema.graphql
README.md
Outdated
} | ||
``` | ||
|
||
Add `delete` resolver to Mutation part of `src/index.js` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer
Add a
delete
resolver to Mutation part ofsrc/index.js
``` | ||
|
||
Run `yarn start` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the example how to delete a post:
mutation {
delete(id: "cuid") {
id
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose you mean, how to delete a post? Made the required changes. Let me know if anything else needed :)
Thanks 🙌 |
For now, I am collecting common scenarios in this issue instead: #35. I moved your descriptions there, as well. Once we collected a few and the |
Sounds good! |
Closes #15
Please let me know if any changes are needed.