Demo projects for flexible-graphql integration with different apps
docker-compose up -d postgresql
wait until they are ready
docker-compose up -d flexible-graphql-bundle no-framework
wait until they are ready
docker-compose up -d apollo-federation
send federated queries to http://localhost:8080/
mutation {
createAccount(number: "asdfasdgas2") {
id
number
currency {
__typename
...on NamedCurrency {
name
}
...on CodedCurrency {
code
}
}
}
}
curl --request POST \
--url http://localhost:8080/ \
--header 'Content-Type: application/json' \
--header 'X-AUTH-ROLE: watcher' \
--header 'X-AUTH-USERNAME: asdf' \
--data '{"query":"mutation {\n createAccount(number: \"asdfasdgas2\") {\n id\n number\n currency {\n __typename\n ...on NamedCurrency {\n name\n }\n ...on CodedCurrency {\n code\n }\n }\n }\n}"}'
mutation {
createTransaction(accountId:"8026c5fd-4cda-4eda-8652-2bdcbf0f2e7f", amount: 222) {
id
amount
status
}
}
curl --request POST \
--url http://localhost:8080/ \
--header 'Content-Type: application/json' \
--header 'X-AUTH-ROLE: watcher' \
--header 'X-AUTH-USERNAME: asdf' \
--data '{"query":"mutation {\n createTransaction(accountId:\"8026c5fd-4cda-4eda-8652-2bdcbf0f2e7f\", amount: 222) {\n id\n amount\n status\n }\n}"}'
query{
currentUser {
username
role
}
mod(input: {x: 11, y: 4})
sum(sumInput: {x: 2, y: 3})
echo(input: "Hello")
print(input: "Hello")
dayTime(timestamps: [
[{
ts: 3
},
{
ts: 99999999
}],
[{
ts: 33333333
}],
])
time
accounts{
id
number
currency {
__typename
...on NamedCurrency {
name
}
...on CodedCurrency {
code
}
}
status
amount
createdAt
transactions{id
amount
status
account{
id
number
currency{
__typename
}
}
log {
__typename
...on TransactionMessageLog {
message
}
...on TransactionCodeLog {
code
}
}
createdAt
}
}
}
curl --request POST \
--url http://localhost:8080/ \
--header 'Content-Type: application/json' \
--header 'X-AUTH-ROLE: watcher' \
--header 'X-AUTH-USERNAME: asdf' \
--data '{"query":"query{\n currentUser {\n username\n role\n }\n mod(input: {x: 11, y: 4})\n sum(sumInput: {x: 2, y: 3})\n echo(input: \"Hello\")\n print(input: \"Hello\")\n\tdayTime(timestamps: [\n\t\t[{\n\t\t\tts: 3\n\t\t},\n\t\t{\n\t\t\tts: 99999999\n\t\t}],\n\t\t[{\n\t\t\tts: 33333333\n\t\t}],\n\t])\n time\n accounts{\n id\n number\n currency {\n __typename\n ...on NamedCurrency {\n name\n }\n ...on CodedCurrency {\n code\n }\n }\n status\n amount\n createdAt\n transactions{id\n amount\n status\n account{\n id\n number\n currency{\n __typename\n }\n }\n log {\n __typename\n ...on TransactionMessageLog {\n message\n }\n ...on TransactionCodeLog {\n code\n }\n }\n createdAt\n }\n }\n}"}'
Command for generate TypeRegistry
php bin/console flexible_graphql:generate-type-registry
Run http server for handle GraphQL requests
php -S localhost:8080 FlexibleGraphqlBundle/index.php
Command for generate TypeRegistry
php NoFramework/generate_type_registry.php
Run http server for handle GraphQL requests
php -S localhost:8080 NoFramework/index.php
install node.js
Install dependency
cd ApolloFederation
npm install
Run Apollo Federation
cd ApolloFederation
node index