{"id":13481210,"url":"https://github.com/graphql-go/handler","last_synced_at":"2025-05-15T17:06:28.702Z","repository":{"id":42019286,"uuid":"43597579","full_name":"graphql-go/handler","owner":"graphql-go","description":"Golang HTTP.Handler for graphl-go","archived":false,"fork":false,"pushed_at":"2024-05-17T18:00:08.000Z","size":62,"stargazers_count":455,"open_issues_count":34,"forks_count":136,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-15T17:06:22.392Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphql-go.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-03T11:57:19.000Z","updated_at":"2025-05-02T16:25:43.000Z","dependencies_parsed_at":"2024-06-18T12:28:01.408Z","dependency_job_id":null,"html_url":"https://github.com/graphql-go/handler","commit_stats":null,"previous_names":["graphql-go/graphql-go-handler","sogko/graphql-go-handler"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-go%2Fhandler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-go%2Fhandler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-go%2Fhandler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-go%2Fhandler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-go","download_url":"https://codeload.github.com/graphql-go/handler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384988,"owners_count":22062422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:00:49.755Z","updated_at":"2025-05-15T17:06:23.693Z","avatar_url":"https://github.com/graphql-go.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# graphql-go-handler [![CircleCI](https://circleci.com/gh/graphql-go/handler.svg?style=svg)](https://circleci.com/gh/graphql-go/handler) [![GoDoc](https://godoc.org/graphql-go/handler?status.svg)](https://godoc.org/github.com/graphql-go/handler) [![Coverage Status](https://coveralls.io/repos/graphql-go/handler/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/graphql-go/handler?branch=master) [![Join the chat at https://gitter.im/graphql-go/graphql](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/graphql-go/graphql?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n\nGolang HTTP.Handler for [graphl-go](https://github.com/graphql-go/graphql)\n\n### Usage\n\n```go\npackage main\n\nimport (\n\t\"net/http\"\n\t\"github.com/graphql-go/handler\"\n)\n\nfunc main() {\n\tschema, _ := graphql.NewSchema(...)\n\n\th := handler.New(\u0026handler.Config{\n\t\tSchema: \u0026schema,\n\t\tPretty: true,\n\t\tGraphiQL: true,\n\t})\n\n\thttp.Handle(\"/graphql\", h)\n\thttp.ListenAndServe(\":8080\", nil)\n}\n```\n\n### Using Playground\n```go\nh := handler.New(\u0026handler.Config{\n\tSchema: \u0026schema,\n\tPretty: true,\n\tGraphiQL: false,\n\tPlayground: true,\n})\n```\n\n### Details\n\nThe handler will accept requests with\nthe parameters:\n\n  * **`query`**: A string GraphQL document to be executed.\n\n  * **`variables`**: The runtime values to use for any GraphQL query variables\n    as a JSON object.\n\n  * **`operationName`**: If the provided `query` contains multiple named\n    operations, this specifies which operation should be executed. If not\n    provided, an 400 error will be returned if the `query` contains multiple\n    named operations.\n\nGraphQL will first look for each parameter in the URL's query-string:\n\n```\n/graphql?query=query+getUser($id:ID){user(id:$id){name}}\u0026variables={\"id\":\"4\"}\n```\n\nIf not found in the query-string, it will look in the POST request body.\nThe `handler` will interpret it\ndepending on the provided `Content-Type` header.\n\n  * **`application/json`**: the POST body will be parsed as a JSON\n    object of parameters.\n\n  * **`application/x-www-form-urlencoded`**: this POST body will be\n    parsed as a url-encoded string of key-value pairs.\n\n  * **`application/graphql`**: The POST body will be parsed as GraphQL\n    query string, which provides the `query` parameter.\n\n\n### Examples\n- [golang-graphql-playground](https://github.com/graphql-go/playground)\n- [golang-relay-starter-kit](https://github.com/sogko/golang-relay-starter-kit)\n- [todomvc-relay-go](https://github.com/sogko/todomvc-relay-go)\n\n### Test\n```bash\n$ go get github.com/graphql-go/handler\n$ go build \u0026\u0026 go test ./...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-go%2Fhandler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-go%2Fhandler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-go%2Fhandler/lists"}