Files
WarpBox/lib/server/server.go
Daniel Legt 87aa4cc6f2 chore(deps): add gin-contrib/gzip for response compression
Add `github.com/gin-contrib/gzip` to the module dependencies and update `go.sum` with the newly introduced transitive dependencies, preparing the Gin server for gzip-compressed responses.chore(deps): add gin-contrib/gzip for response compression

Add `github.com/gin-contrib/gzip` to the module dependencies and update `go.sum` with the newly introduced transitive dependencies, preparing the Gin server for gzip-compressed responses.
2026-04-25 18:04:10 +03:00

23 lines
432 B
Go

package server
import (
"net/http"
"github.com/gin-contrib/gzip"
"github.com/gin-gonic/gin"
)
func Run(addr string) error {
router := gin.Default()
router.LoadHTMLGlob("templates/*.html")
router.GET("/", func(ctx *gin.Context) {
ctx.HTML(http.StatusOK, "index.html", gin.H{})
})
compressed := router.Group("/", gzip.Gzip(gzip.DefaultCompression))
compressed.Static("/static", "./static")
return router.Run(addr)
}