Skip to content

A simple HTTP server that returns the general weather conditions at the provided coordinates.

License

Notifications You must be signed in to change notification settings

jonow/currentWeather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Current Weather

Current Weather is a simple HTTP server that returns the general weather condition and temperature at an endpoint that takes in latitude and longitude coordinates.

Running Server

Start the server by specifying your OpenWeather API key using the -k flag.

currentWeather -k <API key>

Other flags available are:

Flags:
  -k, --apiKey string    OpenWeather API key.
  -h, --help             help for currentWeather
  -v, --logLevel int     Verbosity level for log printing (2+ = Trace, 1 = Debug, 0 = Info).
  -l, --logPath string   File path to save log file to. (default "-")
  -p, --port string      Port the server listens on. (default "9090")

Accessing Endpoint

To get the current weather, connect to the following endpoint with the coordinates seperated by a comma:

localhost/weather/<lat coordinate>,<long coordinate>

Returns a JSON object containing the current weather condition (e.g., clear, rain, snow) and the general temperature (cold, moderate, or hot).

{
    "lat": 39.8097,
    "lon": -98.5556,
    "condition": "Clouds",
    "temperature": "cold"
}

About

A simple HTTP server that returns the general weather conditions at the provided coordinates.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages