mirror of
https://github.com/songquanpeng/message-pusher.git
synced 2025-11-01 20:12:35 +08:00
init: reinitialize from gin-template
This commit is contained in:
18
router/web-router.go
Normal file
18
router/web-router.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"github.com/gin-gonic/contrib/static"
|
||||
"github.com/gin-gonic/gin"
|
||||
"message-pusher/common"
|
||||
"message-pusher/middleware"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func setWebRouter(router *gin.Engine, buildFS embed.FS, indexPage []byte) {
|
||||
router.Use(middleware.GlobalWebRateLimit())
|
||||
router.Use(static.Serve("/", common.EmbedFolder(buildFS, "web/build")))
|
||||
router.NoRoute(func(c *gin.Context) {
|
||||
c.Data(http.StatusOK, "text/html; charset=utf-8", indexPage)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user