Skip to content

Commit

Permalink
Merge pull request #1458 from aaronArinder/getting-started-wording
Browse files Browse the repository at this point in the history
getting started: making the resolver fn section clearer
  • Loading branch information
MichaelJCompton authored Mar 15, 2021
2 parents 4fead48 + aa531ed commit 7258af5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/content/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ func (r *queryResolver) Todos(ctx context.Context) ([]*model.Todo, error) {

We just need to implement these two methods to get our server working:

First we need somewhere to track our state, lets put it in `graph/resolver.go`:
First we need somewhere to track our state, lets put it in `graph/resolver.go`. The `graph/resolver.go` file is where we declare our app's dependencies, like our database. It gets initialized once in `server.go` when we create the graph.

```go
type Resolver struct{
todos []*model.Todo
}
```
This is where we declare any dependencies for our app like our database, it gets initialized once in `server.go` when
we create the graph.

Returning to `graph/schema.resolvers.go`, let's implement the bodies of those automatically generated resolver functions:

```go
func (r *mutationResolver) CreateTodo(ctx context.Context, input model.NewTodo) (*model.Todo, error) {
Expand Down

0 comments on commit 7258af5

Please sign in to comment.