cml04-falcon-ui/handlers/index.go

21 lines
492 B
Go
Raw Normal View History

2024-10-04 20:02:51 +02:00
package handlers
import (
"net/http"
"text/template"
2024-10-06 18:33:18 +02:00
"git.espin.casa/albert/cml04-falcon-ui/storage"
2024-10-04 20:02:51 +02:00
"github.com/julienschmidt/httprouter"
)
2024-10-06 18:33:18 +02:00
func IndexHandler(storage storage.Storager) httprouter.Handle {
2024-10-04 20:02:51 +02:00
return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
2024-10-05 18:43:25 +02:00
t, _ := template.ParseFiles("templates/base.html", "templates/index.html")
2024-10-04 20:02:51 +02:00
err := t.Execute(w, nil)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}
}