package main
import (
"html/template"
"net/http"
"git.sr.ht/~blallo/logz/interface"
)
var uiTmpl = `
WebSocket test
Open the console...
`
var tmpl *template.Template
func init() {
tmpl = template.Must(template.New("testUI").Parse(uiTmpl))
}
type testUIHandler struct {
baseAddr string
logger logz.Logger
}
func (h *testUIHandler) TestUI(w http.ResponseWriter, r *http.Request) {
h.logger.Debug(map[string]any{
"msg": "Serving test ui",
"context": "http",
})
if err := tmpl.ExecuteTemplate(w, "testUI", map[string]string{"BaseAddr": h.baseAddr}); err != nil {
h.logger.Err(map[string]any{
"msg": "Failed to render testUI template",
"context": "http",
"err": err.Error(),
})
}
}