hikan.ru/mvc/controllers/lastfm.go

22 lines
506 B
Go

package controllers
import (
"fmt"
"main/mvc/models"
"net/http"
)
// Обработчик главной страницы
func LastFMHandler(app *models.App) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
sendLastFM(w, app.LastfmLastTrack)
})
}
// Отправляет страницу
func sendLastFM(w http.ResponseWriter, data string) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.WriteHeader(http.StatusOK)
fmt.Fprint(w, data)
}