A simple weather service that provides current weather conditions for a given location.
- Node.js
- Express
- Redis
- Docker
- Docker Compose
- Visual Crossing Weather API
- Docker
- Docker Compose
- Makefile
-
Clone the repository:
git clone https://github.com/vinutama/weather-app.git cd weather-app
-
Go to https://www.visualcrossing.com and Signup to get your API Key
-
Create a
weather.env
file and add your Visual Crossing Weather API key:WEATHER_API_KEY={your_api_key} WEATHER_API_URL=https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/
-
Make sure you already installed
make
on your system# Linux user sudo apt-get update sudo apt-get -y install make # MacOS user brew install make
-
Make sure your docker installed and running on your system, then simply run this command:
make fresh-start
- Endpoint URL:
GET /api/weather/:location
- Description: Retrieves current weather for the specified location.
- Request Parameters:
/:location
, example:/jakarta, /surabaya, etc
- Status Code:
200
: Success status code,400
: If the location is invalid,500
: Internal server error
- Response:
{ "message": "Success Message", "data": { "currentWeather": {Object} // all details current weather on specified location, "location": {String}, "locationDetail": {String}, "timezone": {String}, "latitude": {Float}, "longitude": {Float}, "hourlyWeather": {Array Object} // List of weather conditions hourly, "todayWeatherSummary": {String} // Today summary weather condition. } }
To run the test just simply run:
make test-app
This project is licensed under the MIT License.