Use embedded files
This commit is contained in:
parent
f33d4b6cae
commit
4b08de00b8
@ -4,7 +4,10 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"html/template"
|
||||
|
||||
"git.javil.eu/jacob1123/budgeteer"
|
||||
"git.javil.eu/jacob1123/budgeteer/web"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@ -25,8 +28,10 @@ const (
|
||||
func (h *Handler) Serve() {
|
||||
router := gin.Default()
|
||||
|
||||
router.LoadHTMLGlob("./templates/*")
|
||||
router.Static("/static", "./static")
|
||||
templ := template.Must(template.New("").Funcs(router.FuncMap).ParseFS(web.Templates, "*"))
|
||||
router.SetHTMLTemplate(templ)
|
||||
|
||||
router.StaticFS("/static", http.FS(web.Static))
|
||||
|
||||
router.GET("/", func(c *gin.Context) { c.HTML(http.StatusOK, "index", nil) })
|
||||
router.GET("/login", h.login)
|
||||
|
Loading…
x
Reference in New Issue
Block a user