package handlers

import (
	"html/template"
	"net/http"

	"git.espin.casa/albert/cml04-mediciones/internal/client"
	"github.com/julienschmidt/httprouter"
)

func IndexHandler(client client.IMediciones) httprouter.Handle {
	return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
		t, _ := template.ParseFiles("templates/index.html")
		err := t.Execute(w, nil)
		if err != nil {
			http.Error(w, err.Error(), http.StatusInternalServerError)
			return
		}
	}
}
