24 lines
492 B
Go
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)
|
|
}
|
|
}
|