Gin is a web framework written in Go (Golang) with good performance. GinTool target to make Gin config and start much easier.
To install GinTool package, you need to install Go and set your Go workspace first.
- The first need Go installed (version 1.11+ is required), then you can use the below Go command to install GinTool.
$ go get -u github.com/cytown/gintool
- Import it in your code:
import "github.com/cytown/gintool"
- Test the GinTool
$ go test
- Start the example
$ go run example/example.go
package main
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/cytown/gintool"
)
func main() {
ge, err := gintool.NewGin("testdata/gin.conf")
if err != nil {
fmt.Println("error: ", err)
return
}
ge.Engine.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{"hello": "world"})
})
err = ge.Start()
}