1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
package main import ( "github.com/gin-gonic/gin" "github.com/mattn/go-colorable" ) func main() { gin.DefaultWriter = colorable.NewColorableStderr() r := gin.Default() r.GET("/", func(c *gin.Context) { c.JSON(200, gin.H{ "message": "Hello World", }) }) r.Run() }