command
module
Version:
v0.0.0-...-7bb11d0
Opens a new window with list of versions in this module.
Published: Jun 24, 2023
License: Unlicense
Opens a new window with license information.
Imports: 15
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Weather App
A simple Weather App built with Go that utilizes an external API to fetch current weather data based on a given city.
Features
- Retrieves current weather data from the Weather API
- Supports logging with Logrus Logrus
- Caching with Redis go-redis
- Environment configuration with Viper Viper
- Documentation with Swagger Swaggo
- Echo Framework Echo
Requirements
Installation
-
Clone the repository:
git clone https://github.com/devfurkankizmaz/weather-app.git
-
Navigate to the project directory:
cd weather-app
-
Install the dependencies:
go mod download
-
Set up environment variables:
-
Create a config.yml
file in the project root directory.
-
Add the following variables to the config.yml
file:
SERVER_PORT: :7070
REDIS_ADDRESS: localhost:6379
REDIS_PASS:
REDIS_DB: 0
REDIS_EXPIRY_MIN: 30
CONTEXT_TIMEOUT_SEC: 10
API_KEY: apikey
API_URL: api.weatherapi.com/v1/current.json
-
Replace <your-weather-api-key>
with your actual Weather API key.
-
Replace <redis-address>
, <redis-password>
, <redis-database>
with your Redis server information
-
Run the application
make dev
make run
-
Open your web browser and navigate to localhost:7070/docs/index.html
to access the Swagger documentation.
Usage
- Open your web browser and navigate to
localhost:7070/weather
.
- Append the
city
query parameter to the URL, for example: localhost:7070/weather?city=Istanbul
or localhost:7070/weather?city=New%York
- The application will fetch the current weather data for the specified city and display it
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request.
Documentation
¶
* @File: main.go
* @Description: Creates HTTP server
* @Author: Furkan Kızmaz (dev.furkan@outlook.com)
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.