This is a simple weather API implemented in Go. It fetches weather data from the Central Weather Bureau and serves it via a web API.
- Go 1.20 or higher
- Gin framework
-
Clone the repository:
git clone https://github.com/yourusername/weather_go.git cd weather_go
-
Install the dependencies:
go get -u github.com/gin-gonic/gin
To run the application, use the following command:
```bash
go run main.go
```
The server will start on http://localhost:8080
.
-
Home:
GET /
- Returns a welcome message.
-
Weather:
GET /weather
- Fetches and returns weather data from the Central Weather Bureau.
```plaintext
weather_go/
├── go.mod
├── go.sum
├── main.go
└── README.md
```
This project is licensed under the MIT License.
In the project directory, initialize the Git repository, add files, and make the first commit:
```bash
git init -b main
git add .
git commit -m "Initial commit"
```
- Open GitHub and log into your account.
- Create a new repository named
weather_go
. - Do not check any initialization options (like README or .gitignore).
In the project directory, link the local repository to the GitHub repository and push:
```bash
git remote add origin https://github.com/yourusername/weather_go.git
git push -u origin main
```
Please replace yourusername
with your GitHub username.
Open the GitHub repository page, and you should see the project files and README.md file.
This README provides a complete guide to setting up and running the Go project, including the necessary commands within copyable code blocks. If you need further assistance, feel free to ask.