1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-10 17:12:48 +00:00

expanded permissions functionality - added packr for bundling static assets

This commit is contained in:
2018-04-15 15:28:12 -05:00
parent e36b168a23
commit 89b6d89890
9 changed files with 196 additions and 122 deletions

View File

@@ -1,6 +1,8 @@
package webserver
import (
"github.com/gobuffalo/packr"
"github.com/gin-gonic/gin"
"github.com/mgerb/go-discord-bot/server/config"
"github.com/mgerb/go-discord-bot/server/webserver/handlers"
@@ -10,13 +12,15 @@ import (
func getRouter() *gin.Engine {
router := gin.Default()
router.Static("/static", "./dist/static")
box := packr.NewBox("../../dist/static")
router.StaticFS("/static", box)
router.Static("/public/sounds", config.Config.SoundsPath)
router.Static("/public/youtube", "./youtube")
router.Static("/public/clips", config.Config.ClipsPath)
router.NoRoute(func(c *gin.Context) {
c.File("./dist/static/index.html")
c.Data(200, "text/html", box.Bytes("index.html"))
})
api := router.Group("/api")