graphql-go

command
v0.0.0-...-13a9a9d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

graphql-go

Introduction

This example shows how to use graphql-go in hertz server.

Usage

  • Start server
go run main.go
  • Test
  • Use curl to send a request
curl -X POST 'http://localhost:9090/' --header 'content-type: application/json' --data-raw '{"query":"query{hello}"}'

Result:

> curl -X POST 'http://localhost:9090/' --header 'content-type: application/json' --data-raw '{"query":"query{hello}"}'
{"data":{"hello":"world"}}
curl 'http://localhost:9090/?query=query%7Bhello%7D'

Result:

> curl 'http://localhost:9090/?query=query%7Bhello%7D'
{"data":{"hello":"world"}}
query {
  hello
}
{
  "data": {
    "hello": "world"
  }
}

Warning

We do not recommend using gqlgen in hertz. Because adapting the Go standard library http.Handler and http.HandlerFunc methods results in a performance hit.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL