Added templ, tailwind and frankenui

This commit is contained in:
2025-02-05 01:51:06 +11:00
parent 5c8d4c5158
commit b6feed7c0c
18 changed files with 1754 additions and 21 deletions

36
handlers/static.go Normal file
View File

@@ -0,0 +1,36 @@
package handlers
import (
"net/http"
"os"
)
type justFilesFilesystem struct {
fs http.FileSystem
}
type neuteredReaddirFile struct {
http.File
}
func (fs justFilesFilesystem) Open(name string) (http.File, error) {
f, err := fs.fs.Open(name)
if err != nil {
return nil, err
}
return neuteredReaddirFile{f}, nil
}
func (f neuteredReaddirFile) Readdir(count int) ([]os.FileInfo, error) {
return nil, nil
}
func HandleStatic() http.Handler {
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
nfs := justFilesFilesystem{http.Dir("static")}
fs := http.FileServer(nfs)
fs.ServeHTTP(w, r)
},
)
}