ginzip/example/main.go
Theta-Dev 05a4d62360
All checks were successful
continuous-integration/drone/push Build is passing
remove dead code from example
2021-12-17 19:08:08 +01:00

24 lines
492 B
Go

package main
import (
"code.thetadev.de/TSGRain/ginzip"
"github.com/gin-gonic/gin"
)
func main() {
router := gin.Default()
ui := router.Group("/", ginzip.New(ginzip.DefaultOptions()))
ui.GET("/", getTestHandler("Hello World (should be compressed)"))
api := router.Group("/api")
api.GET("/", getTestHandler("Hello API (should be uncompressed)"))
_ = router.Run(":8080")
}
func getTestHandler(msg string) gin.HandlerFunc {
return func(c *gin.Context) {
c.String(200, msg)
}
}