23 lines
473 B
Go
23 lines
473 B
Go
package ui
|
|
|
|
import (
|
|
"html/template"
|
|
"log"
|
|
"net/http"
|
|
|
|
"streifling.com/jason/cpolis/cmd/data"
|
|
)
|
|
|
|
func ShowRSS(f *data.Feed) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
feed := f.Get()
|
|
rss, err := feed.ToRss()
|
|
if err != nil {
|
|
log.Println(err)
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
return
|
|
}
|
|
template.Must(template.ParseFiles("web/templates/index.html", "web/templates/feed.rss")).Execute(w, rss)
|
|
}
|
|
}
|