Created
April 6, 2019 08:28
-
-
Save jahvi/71ac396fb335e4be0d1262a29298d451 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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