github.com/deadlysurgeon/weather@v0.0.0-20240402201029-3925d9f784b1/README.md (about)

     1  # Weather Service Coding Challenge
     2  
     3  Coding challenge for a basic weather service API caller. Currently uses REST and
     4  is exposed over at `/weather/at` with query parameters `lat` and `lon`.
     5  
     6  ## Environmental Variable Configuration
     7  
     8  This program is configured based off of environmental variables as described
     9  below. They can be set ahead of time or in a .env file, which an `example.env`
    10  is included.
    11  
    12  | ENV              | Desc                              |
    13  | ---------------- | --------------------------------- |
    14  | Net              | Network based configuration       |
    15  | NET_BIND         | Network address binding           |
    16  | NET_TLSCERT      | TLS Certificate Pem file location |
    17  | NET_TLSKEY       | TLS Key Pem file location         |
    18  |                  |                                   |
    19  | Weather          | Weather service configuration     |
    20  | WEATHER_ENDPOINT | Endpoint to hit                   |
    21  | WEATHER_APIKEY   | API Key for openweathermap.org    |
    22  
    23  ## API
    24  
    25  **Endpoint**: `{SERVICE}/weather/at`  
    26  **Query Params:**:
    27  
    28  | Key   | Type    | Desc                                       |
    29  | ----- | ------- | ------------------------------------------ |
    30  | `lat` | float64 | Latitude you want to check the weather of  |
    31  | `lon` | float64 | Longitude you want to check the weather of |
    32  
    33  **Response**:
    34  
    35  ```jsonc
    36  {
    37    "condition": "[snow|rain|thunder]", // This is up to the openweatherapi condition field
    38    "temperature": "[freezing|cold|moderate|hot|burning]",
    39    "temperature_raw": 0 // float32 in metric
    40  }
    41  ```