Chever-John commented on a change in pull request #6449: URL: https://github.com/apache/apisix/pull/6449#discussion_r815535032
########## File path: docs/en/latest/router-radixtree.md ########## @@ -289,6 +291,56 @@ $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f }' ``` +We can verify GraphQL matches in the following two ways: + +1. GraphQL query strings + + ```shell + $ curl -H 'content-type: application/graphql' -X POST http://127.0.0.1:9080/graphql -d ' + query getRepo { + owner { + name + } + repo { + created + } + }' + ``` + +2. JSON format + + ```shell + $ curl -H 'content-type: application/json' -X POST http://127.0.0.1:9080/graphql --data '{"query": "query getRepo { owner {name } repo {created}}"}' + ``` + +Next, try a GET request. +Let's first configure a route like this: + +```shell +$ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d ' +{ + "methods": ["GET"], + "uri": "/_graphql", + "vars": [ + ["graphql_operation", "==", "query"], + ["graphql_name", "==", "getRepo"], + ["graphql_root_fields", "has", "owner"] + ], + "upstream": { + "type": "roundrobin", + "nodes": { + "39.97.63.215:4000": 1 + } + } +}' +``` Review comment: Finished it! Thanks for a review @shuaijinchao -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
