diff --git a/internal/web/const-var.go b/internal/web/const-var.go index 62995d2..1167107 100644 --- a/internal/web/const-var.go +++ b/internal/web/const-var.go @@ -18,3 +18,8 @@ var ( // //go:embed templates/* var templFS embed.FS + +// pubFS - public folder +// +//go:embed public/* +var pubFS embed.FS diff --git a/internal/web/webgui.go b/internal/web/webgui.go index dc02b64..b0994a9 100644 --- a/internal/web/webgui.go +++ b/internal/web/webgui.go @@ -3,7 +3,7 @@ package web import ( "html/template" "log" - // "net/http" + "net/http" "github.com/gin-gonic/gin" @@ -39,11 +39,11 @@ func Gui(dirPath, nodePath string) { gin.SetMode(gin.ReleaseMode) router := gin.Default() - // router.LoadHTMLGlob(TemplPath + "/*.html") + templ := template.Must(template.New("").ParseFS(templFS, "templates/*")) router.SetHTMLTemplate(templ) - router.Static("/public/", "../../internal/web/public") + router.StaticFS("/public", http.FS(pubFS)) router.GET("/", indexHandler) // index.go router.GET("/config/", configHandler) // config.go