cml04-falcon-printer/handlers/index.go

25 lines
562 B
Go
Raw Normal View History

2024-10-24 10:58:03 +02:00
package handlers
import (
"html/template"
"net/http"
"git.espin.casa/albert/cml04-falcon-printer/storage"
"github.com/julienschmidt/httprouter"
)
type PageView struct {
}
func IndexHandler(storage storage.Storager) httprouter.Handle {
return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
// create view
view := &PageView{}
t, _ := template.ParseFiles("templates/base.html", "templates/index.html")
if err := t.Execute(w, view); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}
}