loading htmx
This commit is contained in:
parent
08b669fd8f
commit
434708b291
3 changed files with 8 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"embed"
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
|
@ -16,6 +17,9 @@ type Server struct {
|
||||||
func (h *Server) Close() {
|
func (h *Server) Close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//go:embed static/*
|
||||||
|
var static embed.FS
|
||||||
|
|
||||||
func (h *Server) loadHandler() {
|
func (h *Server) loadHandler() {
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
|
|
||||||
|
|
@ -26,6 +30,8 @@ func (h *Server) loadHandler() {
|
||||||
mux.HandleFunc("GET /cakes", h.render(h.cakes, "cakes"))
|
mux.HandleFunc("GET /cakes", h.render(h.cakes, "cakes"))
|
||||||
mux.HandleFunc("GET /cake/", h.render(h.cake, "cake"))
|
mux.HandleFunc("GET /cake/", h.render(h.cake, "cake"))
|
||||||
mux.HandleFunc("POST /cake/", h.render(h.postCake, "confirmation"))
|
mux.HandleFunc("POST /cake/", h.render(h.postCake, "confirmation"))
|
||||||
|
fs := http.FileServerFS(static)
|
||||||
|
mux.Handle("GET /static/", fs)
|
||||||
|
|
||||||
h.Handler = mux
|
h.Handler = mux
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
internal/server/static/htmx2.04.js
Normal file
1
internal/server/static/htmx2.04.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -4,6 +4,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>{{template "title" .}}</title>
|
<title>{{template "title" .}}</title>
|
||||||
|
<script src="/static/htmx2.04.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue