Problems encountered by gin using gzip compression in Go
- 2020-06-07 04:39:22
- OfStack
Recently, I learned go language and wrote a real estate salary website in Chengdu to capture online recruitment information and make statistics. Encounter 1 pit in the middle to record here for later reference
gzip compression is essential for every web application. This project USES gin as the web framework. gin supports the use of middleware
Installation:
go get github.com/gin-contrib/gzip
Use:
func main() {
r := gin.Default()
r.Use(gzip.Gzip(gzip.DefaultCompression))
r.Run(":8080")
}
conclusion