Skip to content

Commit b49fa81

Browse files
author
Nilan Marktanner
authored
removed instructions about adding new resolver
collecting them in graphql-boilerplates/node-graphql-server#35 instead
1 parent fe55f67 commit b49fa81

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

typescript-basic/README.md

-36
Original file line numberDiff line numberDiff line change
@@ -99,42 +99,6 @@ Access to the Graphcool API is secured by a secret. This also applies to the int
9999

100100
> Note: Currently, no content of the signed JWT is verified. This will be implemented [according to this proposal](https://github.com/graphcool/framework/issues/1365) at a later stage.
101101
102-
#### How to add a new resolver?
103-
Suppose we want to add a custom resolver to delete a post. We can take the following steps:
104-
105-
Add a new `delete` field to the Mutation type in `src/schema.graphql`
106-
```
107-
type Mutation {
108-
createDraft(title: String!, text: String): Post
109-
publish(id: ID!): Post
110-
delete(id: ID!): Post
111-
}
112-
```
113-
114-
Add a `delete` resolver to Mutation part of `src/index.js`
115-
```
116-
delete(parent, { id }, ctx, info) {
117-
return ctx.db.mutation.deletePost(
118-
{
119-
where: { id }
120-
},
121-
info
122-
);
123-
}
124-
```
125-
126-
Run `yarn start`
127-
128-
Then we can run the following mutation to delete a post:
129-
130-
```
131-
mutation {
132-
delete(id: "cuid") {
133-
id
134-
}
135-
}
136-
```
137-
138102
## Community
139103

140104
Graphcool has a community of thousands of amazing developers and contributors. Welcome, please join us! 👋

0 commit comments

Comments
 (0)