Following the medium article Learn Golang + GraphQL + Relay, with some changes derivated of graphql-go evolution.
go get github.com/graphql-go/graphql
go get github.com/graphql-go/graphql-go-handler
Start the GraphQL server:
run main.go
Send queries to GraphQL server:
#curl -XPOST http://localhost:8080/graphql -H 'Content-Type: application/graphql' -d 'query Root{ latestPost }'
#curl -XPOST http://localhost:8080/graphql -H 'Content-Type: application/graphql' -d '{ latestPost }'
curl -XPOST http://localhost:8080/graphql -H 'Content-Type: application/graphql' -d '{Vehicle(id:"2") { name, state }}'
Get the schema meta-data
curl -XPOST http://localhost:8080/graphql -H 'Content-Type: application/graphql' -d '{__schema { queryType { name, fields {name, description }}}}'