使用 Go 實現 CURD 功能

此篇筆記適用於紀錄學習使用 go 作 web service 作練習。是參考這篇影片逐步練習和調整,會有點不一樣但值得參考。 初始化專案 $ go mod init gin-curd # 初始 go 專案模塊 $ go install github.com/cosmtrek/air@latest # 安裝監聽服務,類似 live reload 功能 $ go get -u github.com/gin-gonic/gin # 有名的 routing pkg $ go get github.com/joho/godotenv # .env 環境變數 pkg $ go get -u gorm.io/gorm # DB ORM $ go get -u gorm.io/driver/mysql # mysql driver 設計 Load .env variables Initial database connection and connected Definition routes create update destroy index (plural) show (singular) 實作 controllers models migrations initializers (load ....

March 9, 2023 · Yish