...

Source file src/github.com/gin-gonic/contrib/gzip/example/example.go

Documentation: github.com/gin-gonic/contrib/gzip/example

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/gin-gonic/contrib/gzip"
     6  	"github.com/gin-gonic/gin"
     7  	"time"
     8  )
     9  
    10  func main() {
    11  	r := gin.Default()
    12  	r.Use(gzip.Gzip(gzip.DefaultCompression))
    13  	r.GET("/ping", func(c *gin.Context) {
    14  		c.String(200, "pong "+fmt.Sprint(time.Now().Unix()))
    15  	})
    16  
    17  	// Listen and Server in 0.0.0.0:8080
    18  	r.Run(":8080")
    19  }
    20  

View as plain text