2026-04-25 17:40:39 +03:00
|
|
|
package server
|
|
|
|
|
|
2026-04-25 18:04:10 +03:00
|
|
|
import (
|
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-contrib/gzip"
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
2026-04-25 17:40:39 +03:00
|
|
|
|
|
|
|
|
func Run(addr string) error {
|
|
|
|
|
router := gin.Default()
|
2026-04-25 18:04:10 +03:00
|
|
|
router.LoadHTMLGlob("templates/*.html")
|
2026-04-25 17:40:39 +03:00
|
|
|
|
|
|
|
|
router.GET("/", func(ctx *gin.Context) {
|
2026-04-25 18:04:10 +03:00
|
|
|
ctx.HTML(http.StatusOK, "index.html", gin.H{})
|
2026-04-25 17:40:39 +03:00
|
|
|
})
|
|
|
|
|
|
2026-04-25 18:04:10 +03:00
|
|
|
compressed := router.Group("/", gzip.Gzip(gzip.DefaultCompression))
|
|
|
|
|
compressed.Static("/static", "./static")
|
|
|
|
|
|
2026-04-25 17:40:39 +03:00
|
|
|
return router.Run(addr)
|
|
|
|
|
}
|