20 lines
396 B
Go
20 lines
396 B
Go
|
package handlers
|
||
|
|
||
|
import (
|
||
|
"html/template"
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/julienschmidt/httprouter"
|
||
|
)
|
||
|
|
||
|
func IndexHandler() 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
|
||
|
}
|
||
|
}
|
||
|
}
|