Files
WarpBox/lib/server/server.go

23 lines
432 B
Go
Raw Normal View History

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)
}