package handlers
import (
"html/template"
"log"
"net/http"
)
type blogContext struct {
err *log.Logger
Name string
}
func (ctx *blogContext) index(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
http.NotFound(w, r)
return
}
files := []string{
"ui/html/base.tmpl.html",
"ui/html/music_player.tmpl.html",
"ui/html/pages/index.tmpl.html",
}
compiled, err := template.ParseFiles(files...)
if err != nil {
ctx.err.Print(err.Error())
http.Error(w, "Internal Server Error", 500)
return
}
err = compiled.ExecuteTemplate(w, "base", ctx)
if err != nil {
ctx.err.Print(err.Error())
http.Error(w, "Internal Server Error", 500)
return
}
}