Giter VIP home page Giter VIP logo

goweatherapi's Introduction

Weather API Documentation

This is a simple Weather API developed using the OpenWeather.org API and the Go programming language. This API allows you to fetch weather information for a specific location by making HTTP requests.

Getting Started

To use this Weather API, you will need an API key from OpenWeather.org. You can obtain an API key by signing up on their website.

Prerequisites

  • Go programming language installed on your system.
  • An OpenWeather.org API key.

Installation

  1. Clone this repository to your local machine:

    git clone https://github.com/yourusername/weather-api-golang.git
  2. Change to the project directory:

    cd weather-api-golang
  3. Create a .env file in the project directory and add your OpenWeather.org API key:

    OPENWEATHER_API_KEY=your_api_key_here
  4. Build and run the application:

    go build
    ./weather-api-golang

The API server should now be running locally on port 8080.

Usage

Get Weather Information

To get weather information for a specific location, make a GET request to the following endpoint:

http://localhost:8080/weather?location={location}

Replace {location} with the name of the city or location for which you want weather information.

Example Request:

GET http://localhost:8080/weather?location=New+York

Example Response:

{
  "location": "New York",
  "temperature": 72.5,
  "humidity": 65,
  "description": "Partly cloudy",
  "icon": "http://example.com/weather-icon.png"
}

Error Handling

  • If the API is unable to fetch weather data from OpenWeather.org, it will return a 500 Internal Server Error response.
  • If the location is not found or the API key is invalid, it will return a 404 Not Found response.

Deployment

To deploy this Weather API to a production environment, you can follow these steps:

  1. Deploy the Go application to a web server or cloud platform of your choice.
  2. Set up environment variables for the OpenWeather.org API key in your production environment.
  3. Update the API endpoint in the documentation to point to your production server.

Contributing

If you'd like to contribute to this project, please fork the repository and create a pull request with your changes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Thanks to OpenWeather.org for providing the weather data.
  • This project was created as a learning exercise in Go programming.

Please feel free to reach out with any questions or feedback!

goweatherapi's People

Contributors

therealsaitama avatar

Stargazers

Aakriti Kaushik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.