mugit/internal/handlers/handles.go(view raw)
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"
"path/filepath"
"olexsmir.xyz/mugit/internal/config"
)
type handlers struct {
c *config.Config
t *template.Template
}
func InitRoutes(cfg *config.Config) *http.ServeMux {
tmpls := template.Must(template.ParseGlob(
filepath.Join(cfg.Meta.TemplatesDir, "*"),
))
h := handlers{cfg, tmpls}
mux := http.NewServeMux()
mux.HandleFunc("GET /", h.index)
return mux
}
|