Added templ, tailwind and frankenui
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
"projectreshoot/view/page"
|
||||
)
|
||||
|
||||
func HandleRoot() http.Handler {
|
||||
@@ -12,8 +12,7 @@ func HandleRoot() http.Handler {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
templ := template.Must(template.ParseFiles("templates/index.html"))
|
||||
templ.Execute(w, nil)
|
||||
page.Index().Render(r.Context(), w)
|
||||
},
|
||||
)
|
||||
}
|
||||
36
handlers/static.go
Normal file
36
handlers/static.go
Normal 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)
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user