Skip to content

iamtomhewitt/home-dashboard-weather-manager

Repository files navigation

Home Dashboard Weather Manager

☀ A piggy back API of Darksky to get the weather for my home dashboard.

Pipeline

  • Travis tests the repo using npm test, which runs mocha 'tests/**/*.js' --exit
  • Once the tests pass, Heroku deploys the app.
  • When the app is deployed, you can make requests to it.

Endpoints

/ (GET)

  • The root endpoint, returning information about the app.

Responses

  • 200 success
{
    "status": "🌞 SERVER OK",
    "version": "1.0.0",
    "endpoints": [
        {
            "path": "/weather",
            "methods": [
                "GET"
            ]
        },
        {
            "path": "/",
            "methods": [
                "GET"
            ]
        }
    ]
}

/weather (GET)

  • Gets the weather using latitude and longitude codes.
  • Query parameters:
    • latitude=<latitude>
    • longitude=<longitude>
    • apiKey=<key>

Responses

  • 200 success
{
    "current": {
        "summary": "A summary of the weather",
        "icon": "sunshine",
        "temperature": 15
    },
    "week": [
        {
            "day": "<day>",
            "icon": "cloudy",
            "temperatureLow": 6,
            "temperatureHigh": 10,
        },
        {
            "day": "<day>",
            "icon": "rain",
            "temperatureLow": 4,
            "temperatureHigh": 9,
        },
        ...
    ]
}
  • 400 bad request if there are missing parameters
{
    "status": 400,
    "message": "There are missing query parameters"
}
  • 401 unauthorised if api key is incorrect
{
    "status": 401,
    "message": "API key is incorrect"
}
  • 500 if the weather could not be retrieved
{
    "status": 500,
    "message": "Could not get weather: <error message>"
}

About

☀️A piggy back API of Darksky to get the weather for my home dashboard.

Resources

Stars

Watchers

Forks

Packages

No packages published