☀ A piggy back API of Darksky to get the weather for my home dashboard.
Travis
tests the repo usingnpm test
, which runsmocha 'tests/**/*.js' --exit
- Once the tests pass,
Heroku
deploys the app. - When the app is deployed, you can make requests to it.
- The root endpoint, returning information about the app.
200
success
{
"status": "🌞 SERVER OK",
"version": "1.0.0",
"endpoints": [
{
"path": "/weather",
"methods": [
"GET"
]
},
{
"path": "/",
"methods": [
"GET"
]
}
]
}
- Gets the weather using latitude and longitude codes.
- Query parameters:
latitude=<latitude>
longitude=<longitude>
apiKey=<key>
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>"
}