25 lines
458 B
Go
25 lines
458 B
Go
|
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
|
||
|
}
|
||
|
}
|