weather-app

command module
v0.0.0-...-7bb11d0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2023 License: Unlicense Imports: 15 Imported by: 0

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

  1. Clone the repository:

    git clone https://github.com/devfurkankizmaz/weather-app.git
    
  2. Navigate to the project directory:

    cd weather-app
    
  3. Install the dependencies:

    go mod download
    
  4. 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

  1. Run the application

    make dev
    make run
    
  2. 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

Overview

* @File: main.go * @Description: Creates HTTP server * @Author: Furkan Kızmaz (dev.furkan@outlook.com)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL