Created
October 13, 2023 19:46
-
-
Save Flamefork/2f00268dfb31a2b27dca5c5fc1e1692d to your computer and use it in GitHub Desktop.
mesh-primitives-problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd ~ | |
mkdir mesh | |
cd mesh | |
cat <<EOF > package.json | |
{ | |
"scripts": { | |
"dev": "mesh dev" | |
}, | |
"dependencies": { | |
"@graphql-mesh/cli": "^0.87.14", | |
"@graphql-mesh/graphql": "^0.95.7", | |
"graphql": "^16.8.1" | |
} | |
} | |
EOF | |
cat <<-"EOF" > .meshrc.yaml | |
serve: | |
port: 4040 | |
fork: 1 | |
sources: | |
- name: example1 | |
handler: | |
graphql: | |
endpoint: http://example1.com | |
source: example.graphql | |
- name: example2 | |
handler: | |
graphql: | |
endpoint: http://example2.com | |
source: example.graphql | |
EOF | |
cat <<-"EOF" > example.graphql | |
type Query { | |
res: Res! | |
} | |
type Mutation { | |
mut(input: MutInput!): Res! | |
} | |
type Res { | |
id: ID! | |
text: String! | |
} | |
input MutInput { | |
text: String! | |
} | |
EOF | |
npm install | |
npm run dev & | |
sleep 10 | |
curl -X POST \ | |
-H content-type:application/json \ | |
-v \ | |
-d '{"query": "mutation ($input: MutInput!) { mut(input: $input) { id } }", "variables": {"input": {"bogus": "Res"}}}' \ | |
http://localhost:4040/graphql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment