Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions src/code/language-support/go/server/gql-go-graphql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: gql-go/graphql
description: A code-first implementation of GraphQL for Go, the community-maintained continuation of graphql-go/graphql.
github: gql-go/graphql
tags:
- tools-and-libraries
- backend
---

`gql-go/graphql` is the actively maintained continuation of
`graphql-go/graphql`, the code-first GraphQL library that many Go services run
in production. Moving over takes one change: replace the import prefix, and
your schema, resolvers and tests keep working as they did on `v0.8.1`.

From there you get frequent releases, issues and pull requests that get an
answer, and steady progress towards the current GraphQL specification. Every
new feature is additive and opt-in, so upgrading never breaks the code you
already have.

To run a hello world server:

```go
package main

import (
"log"
"net/http"

"github.com/gql-go/graphql"
"github.com/gql-go/handler"
)

func main() {
schema, err := graphql.NewSchema(graphql.SchemaConfig{
Query: graphql.NewObject(graphql.ObjectConfig{
Name: "Query",
Fields: graphql.Fields{
"hello": &graphql.Field{
Type: graphql.String,
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
return "world", nil
},
},
},
}),
})
if err != nil {
log.Fatal(err)
}

http.Handle("/graphql", handler.New(&handler.Config{Schema: &schema}))
log.Fatal(http.ListenAndServe(":8080", nil))
}
```

Guides are at [gql-go.github.io/graphql](https://gql-go.github.io/graphql/).
Loading