- 創建專案
mkdir {專案名稱}
cd {專案名稱}
- 創建主要檔案
touch main.go
- main.go必要內容
package main
func main() {
}
- 初始化模組
go mod init {專案名稱} # 會產生go.mod
go get github.com/gin-gonic/gin
# 執行go get時,會自動產生go.sum
go run main.go
# 或是
go run .
/albums
- GET – Get a list of all albums, returned as JSON.
- POST – Add a new album from request data sent as JSON.
/albums/:id
- GET – Get an album by its ID, returning the album data as JSON.