This project is a starting platform for a Golang project with Gin webframework that pulls data from an external API and caches the result. The project includes a responsive Bootstrap template.
🏠 Homepage
tbd
- golang > 1.18
go install
You can set the following environment variables:
NAME | required | Comment |
---|---|---|
API_KEY |
yes | You can get your own free OpenWeatherApi key on this website: https://home.openweathermap.org/users/sign_up |
HOST |
yes | Listening on given ip adress (default: "" maps to 0.0.0.0) |
PORT |
yes | Listening on given port (default: 8080) |
You can either set the environment variables or use the .env
file:
Make your own copy of the .env
file and specify the .env
and add the keys.
cp ./.env_default ./.env
Learn more about the OpenWeatherMap API: https://openweathermap.org/api
First, run the development server:
go run main.go
Open http://localhost:8080 with your browser to see the result.
go build main.go
./main