package web import ( "net/http" "github.com/Jaculabilis/intake/core" "github.com/Jaculabilis/intake/web/html" ) type FeedData struct { Items []core.Item } func (env *Env) sourceHandler(writer http.ResponseWriter, req *http.Request) { source := req.URL.Path[len("/source/"):] // TODO this needs to properly error if the source doesn't exist instead of just returning [] items, err := core.GetAllItemsForSource(env.db, source) if err != nil { http.NotFound(writer, req) return } html.Feed(writer, FeedData{items}) }