feat: save messages to database (close #37)

This commit is contained in:
JustSong
2022-12-22 17:59:12 +08:00
parent f13ce0d53b
commit d26e578762
19 changed files with 682 additions and 34 deletions
+3
View File
@@ -5,6 +5,7 @@ import (
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
"message-pusher/common"
"message-pusher/controller"
"message-pusher/middleware"
"net/http"
)
@@ -12,6 +13,8 @@ import (
func setWebRouter(router *gin.Engine, buildFS embed.FS, indexPage []byte) {
router.Use(middleware.GlobalWebRateLimit())
router.Use(middleware.Cache())
router.GET("/public/static/:file", controller.GetStaticFile)
router.GET("/message/:link", controller.RenderMessage)
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)