music.go (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
package main
import (
"net/http"
"text/template"
)
func musicHandler(w http.ResponseWriter, r *http.Request) {
results := loadMusic()
tmpl := template.Must(template.ParseFiles("templates/music.html"))
err := tmpl.Execute(w, results)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
|