loading htmx

This commit is contained in:
bronku 2025-03-29 07:40:52 +01:00
parent 08b669fd8f
commit 434708b291
3 changed files with 8 additions and 0 deletions

View file

@ -1,6 +1,7 @@
package server
import (
"embed"
"html/template"
"net/http"
@ -16,6 +17,9 @@ type Server struct {
func (h *Server) Close() {
}
//go:embed static/*
var static embed.FS
func (h *Server) loadHandler() {
mux := http.NewServeMux()
@ -26,6 +30,8 @@ func (h *Server) loadHandler() {
mux.HandleFunc("GET /cakes", h.render(h.cakes, "cakes"))
mux.HandleFunc("GET /cake/", h.render(h.cake, "cake"))
mux.HandleFunc("POST /cake/", h.render(h.postCake, "confirmation"))
fs := http.FileServerFS(static)
mux.Handle("GET /static/", fs)
h.Handler = mux
}