Skip to content

mostafasolati/gzip

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GZIP gin's middleware

Build Status codecov Go Report Card GoDoc Join the chat at https://gitter.im/gin-gonic/gin

Gin middleware to enable GZIP support.

Usage

Start using it

Download and install it:

$ go get github.com/gin-contrib/gzip

Import it in your code:

import "github.com/gin-contrib/gzip"

Canonical example:

package main

import (
	"fmt"
	"time"

	"github.com/gin-contrib/gzip"
	"github.com/gin-gonic/gin.v1"
)

func main() {
	r := gin.Default()
	r.Use(gzip.Gzip(gzip.DefaultCompression))
	r.GET("/ping", func(c *gin.Context) {
		c.String(200, "pong "+fmt.Sprint(time.Now().Unix()))
	})

	// Listen and Server in 0.0.0.0:8080
	r.Run(":8080")
}

About

Gin middleware to enable GZIP support.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Go 100.0%