From 0e25c5d00941b18186737661f8d2cb5b2c414858 Mon Sep 17 00:00:00 2001 From: Monaco Date: Wed, 2 Dec 2026 23:48:06 -0300 Subject: [PATCH] Add gql-go/graphql to the Go server libraries Co-Authored-By: Claude Fable 5.2 --- .../go/server/gql-go-graphql.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/code/language-support/go/server/gql-go-graphql.md diff --git a/src/code/language-support/go/server/gql-go-graphql.md b/src/code/language-support/go/server/gql-go-graphql.md new file mode 100644 index 0000000000..e7709501f3 --- /dev/null +++ b/src/code/language-support/go/server/gql-go-graphql.md @@ -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/).