graphql client

https://blog.csdn.net/liuyh73/article/details/85028977
https://github.com/dotansimha/graphql-code-generator
https://graphql-code-generator.com/
https://ednsquare.com/story/graphql-core-graphql-client-implementations——U8NKlY
https://awesomeopensource.com/project/chentsulin/awesome-graphql
https://github.com/chentsulin/awesome-graphql
https://www.apollographql.com/
https://github.com/apollographql/apollo/blob/master/docs/source/tutorial/introduction.md
https://dev.to/glyphack/introduction-to-graphql-server-with-golang-1npk



server
https://99designs.com/blog/engineering/gqlgen-a-graphql-server-generator-for-go/
https://github.com/graph-gophers/graphql-go
https://github.com/samsarahq/thunder



php
https://github.com/mghoneimy/php-graphql-client
https://github.com/thecodingmachine/graphqlite



https://github.com/camuthig/php-graphql-client-generator
https://github.com/kolah/php-graphql-client-generator-cli
https://thecodingmachine.io/graphqlite-graphql-in-php-easy
https://graphqlite.thecodingmachine.io/docs/type_mapping#array-mapping



golang
https://github.com/shurcooL/graphql
https://github.com/machinebox/graphql
https://dev.to/yamashou/generate-graphql-client-code-with-go-5gnd
https://github.com/Yamashou/gqlgenc




https://github.com/microsvs/demo
https://www.jianshu.com/p/16719baa1713
https://graphql.cn/code/#go
https://github.com/machinebox/graphql
https://github.com/TsMask/graphql-server-go
https://zhuanlan.zhihu.com/p/35792985
https://zhuanlan.zhihu.com/p/38958962
https://github.com/darker11/graphql
https://github.com/graph-gophers/graphql-go
https://github.com/graphql-go/graphql/tree/master/examples



注意提交文件的格式和client



$curl -g http://localhost:8080/query
{“errors”:[{“message”:”operation not found”}],”data”:null}



$curl -g http://localhost:8080/query/
<!DOCTYPE html>




<meta charset=utf-8/>
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, minimum-s


$go run client.go
{people(id:"3") {
name
films{title}}

{"errors":[{"message":"Expected Name, found \u003cEOF\u003e","locations":
[{"line":3,"column":16}],"extensions":{"code":"GRAPHQL_PARSE_FAILED"}}],"data":null}


COPY CURL

$curl 'http://localhost:8080/query' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json'
-H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: http://localhost:8080'
--data-binary '{"query":"{people(id:\"3\") {\n name\n films{title}\n }\n}"}' --compressed
{"data":{"people":{"name":"test","films":null}}}


$curl 'http://localhost:8080/query' --data-binary '{"query":"{people(id:\"3\") {\n name\n films{title}\n }\n}"}'
-H 'Content-Type: application/json'
{"data":{"people":{"name":"test","films":null}}}

$curl 'http://localhost:8080/query' --data '{"query":"{people(id:\"3\") {\n name\n films{title}\n }\n}"}'
-H 'Content-Type: application/json'
{"data":{"people":{"name":"test","films":null}}}

原因格式不对
>>reqquest body -> :{"query":"{\"query\":\"{people(id:\\\"3\\\") {\\n name\\n films{title}\\n }\\n}\"}","variables":null}

原因,请求的时候对string又格式化了一回,不合理,直接发原始string就可以了
r, err := http.NewRequest(http.MethodPost, c.endpoint, bytes.NewReader([]byte(req.q)))


https://catonmat.net/cookbooks/curl/make-post-request#post-binary-file-set-mime

https://gist.github.com/ebraminio/576fdfdff425bf3335b51a191a65dbdb
https://mholt.github.io/curl-to-go/
https://www.cnblogs.com/mafeng/p/7068837.html

Category golang