Gzip
Middleware gzip provides compress to responses for Macaron Instances. Make sure to register it before other middlewares that write content to response.
Installation
go get github.com/go-macaron/gzipUsage
package main
import (
"github.com/go-macaron/gzip"
"gopkg.in/macaron.v1"
)
func main() {
m := macaron.Classic()
m.Use(gzip.Gziper())
// Register routers.
m.Run()
}In this case, the static files will not be compressed by Gzip, to compress them:
Or you can choose to only compress a group of routes' responses:
Options
This service comes with a variety of configuration options(gzip.Options):
Last updated
Was this helpful?