hanayo/vendor/github.com/johnniedoe/contrib/gzip/example/example.go
2019-02-23 13:29:15 +00:00

20 lines
338 B
Go

package main
import (
"fmt"
"github.com/gin-gonic/contrib/gzip"
"github.com/gin-gonic/gin"
"time"
)
func main() {
r := gin.Default()
r.Use(gzip.Gzip(gzip.DefaultCompression))
r.GET("/ping", func(c *gin.Context) {
c.String(200, "pong "+fmt.Sprint(time.Now().Unix()))
})
// Listen and Server in 0.0.0.0:8080
r.Run(":8080")
}