blob: 89adcb1ef861a23d1004b5292b701c4b918943e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package handlers
import (
"html/template"
"net/http"
"git.mihna123.com/openstore/internal/config"
"git.mihna123.com/openstore/internal/web"
)
type Handler struct {
tmpl *template.Template
cfg *config.Config
}
func Routes(conf *config.Config) *http.ServeMux {
handler := Handler{
tmpl: template.Must(template.ParseFS(web.Files, "templates/*.html")),
cfg: conf,
}
mux := http.NewServeMux()
mux.HandleFunc("GET /{$}", handler.home)
mux.Handle("GET /css/", http.FileServerFS(web.Files))
return mux
}
|