Move init of StaticFS and rename some vars

This commit is contained in:
2022-02-15 12:37:23 +00:00
parent 74a53954de
commit 2f45c415e0
4 changed files with 20 additions and 17 deletions

View File

@@ -11,7 +11,6 @@ import (
"git.javil.eu/jacob1123/budgeteer"
"git.javil.eu/jacob1123/budgeteer/bcrypt"
"git.javil.eu/jacob1123/budgeteer/postgres"
"git.javil.eu/jacob1123/budgeteer/web"
"github.com/gin-gonic/gin"
)
@@ -36,12 +35,6 @@ func (h *Handler) Serve() {
// LoadRoutes initializes all the routes
func (h *Handler) LoadRoutes(router *gin.Engine) {
static, err := fs.Sub(web.Static, "dist")
if err != nil {
panic("couldn't open static files")
}
h.StaticFS = http.FS(static)
router.Use(enableCachingForStaticFiles())
router.NoRoute(h.ServeStatic)