Gzip
Last updated
Was this helpful?
Was this helpful?
package main
import (
"github.com/go-macaron/gzip"
"gopkg.in/macaron.v1"
)
func main() {
m := macaron.New()
m.Use(macaron.Logger())
m.Use(macaron.Recovery())
m.Use(gzip.Gziper())
m.Use(macaron.Static("public"))
// Register routers.
m.Run()
}// ...
func main() {
m := macaron.Classic()
m.Group("/gzip", func() {
// ...
}, gzip.Gziper())
// ...
m.Run()
}// ...
m.Use(gzip.Gziper(gzip.Options{
// Compression level. Can be DefaultCompression(-1), ConstantCompression(-2)
// or any integer value between BestSpeed(1) and BestCompression(9) inclusive.
// Default is 4.
CompressionLevel: 4,
}))
// ...