fupie/ws/html/index.go

25 lines
458 B
Go
Raw Normal View History

2022-09-02 15:42:48 +01:00
package html
import (
"embed"
"html/template"
"net/http"
"sectorinf.com/emilis/fupie/ws/route"
)
//go:embed templates
var templates embed.FS
func Index(ctx route.Context) {
tmpl, err := template.ParseFS(templates, "templates/index.html")
if err != nil {
panic(err)
}
if err := tmpl.Execute(ctx.Writer, struct{}{}); err != nil {
ctx.Log.Errorf("index.html template: %s", err.Error())
ctx.Status(http.StatusInternalServerError)
return
}
}