Skip to content

konstantinmuenster/graphql-weather-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌦️ GraphQL Weather API

A GraphQL Wrapper for the Open Weather Map 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 🌈

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

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. Then, create an .env file and add the following variable: KEY=<YOUR-APP-ID>

npm install
npm run dev # Using nodemon for auto-reloading

The server starts at http://localhost:4000/

About

Konstantin Münster – konstantin.digitalmail@konstantin.digital

Distributed under the MIT license. See LICENSE for more information.

https://github.com/konstantinmuenster