feat: enable gzip on api route & web route

This commit is contained in:
JustSong
2023-04-25 21:56:07 +08:00
parent 69ee87c57f
commit 284beed8dc
2 changed files with 4 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package router
import (
"embed"
"github.com/gin-contrib/gzip"
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
"net/http"
@@ -10,6 +11,7 @@ import (
)
func setWebRouter(router *gin.Engine, buildFS embed.FS, indexPage []byte) {
router.Use(gzip.Gzip(gzip.DefaultCompression))
router.Use(middleware.GlobalWebRateLimit())
router.Use(middleware.Cache())
router.Use(static.Serve("/", common.EmbedFolder(buildFS, "web/build")))