Skip to content

javierlinked/test-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather API

A simple REST API built with Go that provides weather information based on city names.

Features

  • REST endpoint to get weather by city name
  • Swagger UI documentation
  • Simple and clean architecture

Prerequisites

  • Go 1.16 or higher
  • Internet connection for downloading dependencies

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd weather-api
  2. Install dependencies:

    go mod download
  3. Generate Swagger documentation:

    go install github.com/swaggo/swag/cmd/swag@latest
    swag init

Running the Application

Start the server:

go run main.go

The server will start on port 8080.

API Usage

Get Weather by City Name

GET /api/v1/weather?city=London

Example response:

{
  "city": "London",
  "temperature": 15.5,
  "condition": "Cloudy",
  "humidity": 70,
  "wind_speed": 5.2
}

Swagger Documentation

Access the Swagger UI at:

http://localhost:8080/swagger/index.html

Notes

This is a demonstration API that simulates weather data. In a production environment, you would integrate with a real weather data provider like OpenWeatherMap, AccuWeather, etc.

License

MIT

About

Backend Rest API implementation in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages