Esempio n. 1
0
func List(w http.ResponseWriter, r *http.Request) {
	data := make(middleware.Data)
	articles, err := article.List()
	if err != nil {
		middleware.Fatal(w)
		return
	}
	data["Title"] = "Recent articles"
	data["Articles"] = articles
	middleware.RenderView(w, "list.html", data)
}
Esempio n. 2
0
func ListArticle(w http.ResponseWriter, r *http.Request) {
	articles, _ := article.List()
	middleware.RenderJSON(w, articles)
}