update example to use weather api
This commit is contained in:
parent
b8e8c5e29c
commit
1887dccdf5
@ -1,8 +0,0 @@
|
|||||||
query Starters {
|
|
||||||
pokemon_pokemons(limit: 12) {
|
|
||||||
results {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
22
.wundergraph/operations/Weather.graphql
Normal file
22
.wundergraph/operations/Weather.graphql
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
query ($city: String!) {
|
||||||
|
weather_getCityByName(name: $city config: {units: metric}) {
|
||||||
|
coordinates: coord {
|
||||||
|
lat
|
||||||
|
lon
|
||||||
|
}
|
||||||
|
country
|
||||||
|
weather {
|
||||||
|
temperature {
|
||||||
|
actual
|
||||||
|
feelsLike
|
||||||
|
min
|
||||||
|
max
|
||||||
|
}
|
||||||
|
summary {
|
||||||
|
title
|
||||||
|
description
|
||||||
|
icon
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,15 +9,15 @@ import {
|
|||||||
import server from './wundergraph.server';
|
import server from './wundergraph.server';
|
||||||
import operations from './wundergraph.operations';
|
import operations from './wundergraph.operations';
|
||||||
|
|
||||||
const pokemonAPI = introspect.graphql({
|
const weather = introspect.graphql({
|
||||||
apiNamespace: 'pokemon',
|
apiNamespace: 'weather',
|
||||||
url: 'https://graphql-pokeapi.graphcdn.app/',
|
url: 'https://graphql-weather-api.herokuapp.com/',
|
||||||
});
|
});
|
||||||
|
|
||||||
const myApplication = new Application({
|
const myApplication = new Application({
|
||||||
name: 'app',
|
name: 'app',
|
||||||
apis: [
|
apis: [
|
||||||
pokemonAPI,
|
weather,
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
23
README.md
23
README.md
@ -1,6 +1,6 @@
|
|||||||
# Simple starter for WunderGraph Cloud
|
# Simple starter for WunderGraph Cloud
|
||||||
|
|
||||||
A simple starter that consumes the [Pokémon GraphQL API](https://graphql-pokeapi.vercel.app).
|
A simple starter that consumes the [GraphQL Weather API](https://graphql-weather-api.herokuapp.com/).
|
||||||
|
|
||||||
### Getting started locally
|
### Getting started locally
|
||||||
|
|
||||||
@ -8,10 +8,10 @@ A simple starter that consumes the [Pokémon GraphQL API](https://graphql-pokeap
|
|||||||
npm install && npm start
|
npm install && npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
Get first 3 starter Pokémon and their evolutions
|
Get the weather for Berlin.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -X GET http://localhost:9991/app/main/operations/Starters
|
curl -X GET http://localhost:9991/app/main/operations/Weather?city=Berlin
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -24,6 +24,23 @@ curl -X GET http://localhost:9991/app/main/operations/Starters
|
|||||||
4. Import the forked repo
|
4. Import the forked repo
|
||||||
5. Deploy the project
|
5. Deploy the project
|
||||||
|
|
||||||
|
Try it out (replace `YOUR_PROJECT_ID` with your project id):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl -X GET https://{YOUR_PROJECT_NAME}.wundergraph.dev/app/main/operations/Weather?city=Berlin
|
||||||
|
```
|
||||||
|
|
||||||
|
### Make changes
|
||||||
|
|
||||||
|
1. Make changes to the `main` branch, e.g. change the query in `.wundergraph/operations/Weather.graphql`
|
||||||
|
2. Commit and push the changes
|
||||||
|
|
||||||
|
See your changes live in less than 20 seconds.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl -X GET https://{YOUR_PROJECT_NAME}.wundergraph.dev/app/main/operations/Weather?city=Berlin
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
### Learn More
|
### Learn More
|
||||||
|
|
||||||
|
5297
package-lock.json
generated
Normal file
5297
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user