Skip to content

Instantly share code, notes, and snippets.

@jahvi
Created April 6, 2019 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jahvi/71ac396fb335e4be0d1262a29298d451 to your computer and use it in GitHub Desktop.
Save jahvi/71ac396fb335e4be0d1262a29298d451 to your computer and use it in GitHub Desktop.
status: response.status # [Go to 1]
headers: response.headers # [Go to 1]
body: response.body # [Go to 1]
# 1
response:
when:
- matches: request.url.pathname
pattern: '^/pokemon/graphql'
use: pokemonGQL # [Go to 2]
- matches: request.url.pathname
pattern: '^/countries/graphql'
use: countriesGQL # [Go to 3]
default: pokemon # [Go to 4]
# 2
pokemonGQL:
target: env.POKEMON_GRAPHQL_URL
# 3
countriesGQL:
target: env.COUNTRIES_GRAPHQL_URL
# 4
pokemon:
inline:
status: 200
headers:
inline:
content-type:
inline: text/html
body:
engine: mustache
template: './templates/pokemon.mst'
provide:
pokemonData: pokemonData # [Go to 5]
# 5
pokemonData: pokemonResult.data.pokemon # [Go to 6]
# 6
pokemonResult:
url: env.POKEMON_GRAPHQL_URL
query:
resolver: inline
inline: '{
pokemon(name: "Pikachu") {
name
image
types
weight {
minimum
maximum
}
height {
minimum
maximum
}
classification
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment