Fix subdir static/
This commit is contained in:
parent
a891047b7a
commit
30b306e485
@ -1,6 +1,7 @@
|
|||||||
package http
|
package http
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -31,7 +32,11 @@ func (h *Handler) Serve() {
|
|||||||
templ := template.Must(template.New("").Funcs(router.FuncMap).ParseFS(web.Templates, "*"))
|
templ := template.Must(template.New("").Funcs(router.FuncMap).ParseFS(web.Templates, "*"))
|
||||||
router.SetHTMLTemplate(templ)
|
router.SetHTMLTemplate(templ)
|
||||||
|
|
||||||
router.StaticFS("/static", http.FS(web.Static))
|
static, err := fs.Sub(web.Static, "static")
|
||||||
|
if err != nil {
|
||||||
|
panic("couldn't open static files")
|
||||||
|
}
|
||||||
|
router.StaticFS("/static", http.FS(static))
|
||||||
|
|
||||||
router.GET("/", func(c *gin.Context) { c.HTML(http.StatusOK, "index", nil) })
|
router.GET("/", func(c *gin.Context) { c.HTML(http.StatusOK, "index", nil) })
|
||||||
router.GET("/login", h.login)
|
router.GET("/login", h.login)
|
||||||
|
@ -5,5 +5,5 @@ import "embed"
|
|||||||
//go:embed *.html
|
//go:embed *.html
|
||||||
var Templates embed.FS
|
var Templates embed.FS
|
||||||
|
|
||||||
//go:embed static/*
|
//go:embed static
|
||||||
var Static embed.FS
|
var Static embed.FS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user