go get -u github.com/gin-gonic/gin
go mod init {프로젝트-명}
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
출처
https://stackoverflow.com/questions/61091852/how-to-install-gin-with-golang