1package main
2
3import (
4 "embed"
5 "net/http"
6 "html/template"
7
8 "github.com/senpro-it/test-daisyui/components"
9
10 "github.com/a-h/templ"
11)
12
13//go:embed public/output.css
14var cssContent embed.FS
15
16//go:embed shell.html
17var htmlContent embed.FS
18
19func main() {
20 http.HandleFunc("/style.css", func(w http.ResponseWriter, r *http.Request) {
21 data, err := cssContent.ReadFile("public/output.css")
22 if err != nil {
23 http.Error(w, "Could not read CSS file", http.StatusInternalServerError)
24 return
25 }
26 w.Header().Set("Content-Type", "text/css")
27 w.Write(data)
28 })
29 http.Handle("/", templ.Handler(components.Main()))
30 /*
31 http.Handle("/a", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
32 shellContent, _ := htmlContent.ReadFile("shell.html")
33 shell := template.New(string(shellContent))
34 base := templ.FromGoHTML(shell, map[string]templ.Component{
35 "head": nil,
36 "body":
37 })
38 }))
39 */
40 http.ListenAndServe(":9898", nil)
41}