package handlers
import (
"html/template"
"log/slog"
"net/http"
)
func init() {
// init slog to be at level debug and us json structured logs; ai!
slog = slog.New()
}
var roundWords = map[string]string{
"hamster": "blue",
"child": "red",
"wheel": "white",
"condition": "black",
"test": "white",
}
func HandlePing(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("pong"))
}
func HandleHome(w http.ResponseWriter, r *http.Request) {
tmpl, err := template.ParseGlob("components/*.html")
if err != nil {
abortWithError(w, err.Error())
return
}
tmpl.ExecuteTemplate(w, "main", roundWords)
}