Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 1.4 KB

TEST.md

File metadata and controls

52 lines (40 loc) · 1.4 KB

Quick start

Start GraphQL server

php -S localhost:8080 example/start_graphql_server.php

Fetch dynamicSum

query {
  dynamicSum(x: 1, y: 2)
}
curl --request POST -sL \
     --url 'http://localhost:8080'\
     --header 'Content-Type: application/json' \
     --data-raw '{"query":"query {\n  dynamicSum(x: 1, y: 2)\n}"}'

What is happening here?

Code execute dynamicSum resolver with arguments x: 1, y: 2 based in DynamicSumResolver class and execute plusX directive with arguments x: 4 based in PlusXDirective class defined in schema.graphql file in 10th line.

Fetch Federation entities

query {
    _entities(representations: [{__typename: "Account", id: "9999"}]) {
        ... on Account {
            id
        }
    }
}
curl --request POST -sL \
     --url 'http://localhost:8080'\
     --header 'Content-Type: application/json' \
     --data-raw '{"query":"query {\n    _entities(representations: [{__typename: \"Account\", id: \"9999\"}]) {\n        ... on Account {\n            id\n        }\n    }\n}"}'

What is happening here?

Code execute _entities resolver with arguments representations: [{__typename: "Account", id: "9999"}] based in AccountRepresentation class