Skip to content

hanc1027-articles/Go-Gin-Starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Gin Starter

初始化

  • 創建專案
    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 .

參考

此專案的Endpoints

/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.

About

使用Golang製作API,起手式

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages