https://github.com/konstantinruge/graphql-weather-api
A GraphQL wrapper for the Open Weather Map API
https://github.com/konstantinruge/graphql-weather-api
apollo-server graphql graphql-api open-weather-map-api weather-api
Last synced: 7 months ago
JSON representation
A GraphQL wrapper for the Open Weather Map API
- Host: GitHub
- URL: https://github.com/konstantinruge/graphql-weather-api
- Owner: konstantinmuenster
- License: mit
- Created: 2020-08-08T12:15:09.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-08T13:10:42.000Z (almost 6 years ago)
- Last Synced: 2024-09-28T21:23:40.439Z (over 1 year ago)
- Topics: apollo-server, graphql, graphql-api, open-weather-map-api, weather-api
- Language: JavaScript
- Homepage: https://graphql-weather-api.herokuapp.com/
- Size: 39.1 KB
- Stars: 31
- Watchers: 2
- Forks: 18
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🌦️ GraphQL Weather API
#### A GraphQL Wrapper for the [Open Weather Map API](https://openweathermap.org/api)
Retrieve the current weather for any given city. Since this GraphQL API uses the free-tier of the Open Weather Map API, it is restricted to 60 calls/minute.
However, feel free to use it for prototyping and demo projects anyways. A live version is available at:
[graphql-weather-api.herokuapp.com](https://graphql-weather-api.herokuapp.com/) 🌈
## How to Use
#### Queries
* getCityByName (`name` *required*, `country` *optional*, `config` *optional*)
* getCityById (`id` *required*, , `config` *optional*)
*Language and unit system can be specified via `config`.*
#### Example with all weather data
```graphql
query {
getCityByName(name: "Gothenburg") {
id
name
country
coord {
lon
lat
}
weather {
summary {
title
description
icon
}
temperature {
actual
feelsLike
min
max
}
wind {
speed
deg
}
clouds {
all
visibility
humidity
}
timestamp
}
}
}
```
## How to Install
For running this project locally, you must register your own application at [Open Weather Map](https://openweathermap.org/api). Then, create an .env file and add the following variable: `KEY=`
```sh
npm install
npm run dev # Using nodemon for auto-reloading
```
The server starts at http://localhost:4000/
## About
Konstantin Münster – [konstantin.digital](https://konstantin.digital) – [mail@konstantin.digital](mailto:mail@konstantin.digital)
Distributed under the [MIT](http://showalicense.com/?fullname=Konstantin+M%C3%BCnster&year=2019#license-mit) license.
See ``LICENSE`` for more information.
[https://github.com/konstantinmuenster](https://github.com/konstantinmuenster)