Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Fix reciever of query resolver in readme.
  • Loading branch information
pavelnikolov committed Sep 2, 2023
1 parent 3ce697c commit 64937ad
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,28 @@ In order to run a simple GraphQL server locally create a `main.go` file with the
package main

import (
"log"
"net/http"
"log"
"net/http"

graphql "github.com/graph-gophers/graphql-go"
"github.com/graph-gophers/graphql-go/relay"
graphql "github.com/graph-gophers/graphql-go"
"github.com/graph-gophers/graphql-go/relay"
)

type query struct{}

func (_ *query) Hello() string { return "Hello, world!" }
func (query) Hello() string { return "Hello, world!" }

func main() {
s := `
type Query {
hello: String!
}
`
schema := graphql.MustParseSchema(s, &query{})
http.Handle("/query", &relay.Handler{Schema: schema})
log.Fatal(http.ListenAndServe(":8080", nil))
s := `
type Query {
hello: String!
}
`
schema := graphql.MustParseSchema(s, &query{})
http.Handle("/query", &relay.Handler{Schema: schema})
log.Fatal(http.ListenAndServe(":8080", nil))
}

```
Then run the file with `go run main.go`. To test:

Expand Down

0 comments on commit 64937ad

Please sign in to comment.