Ejemplo 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)
}
Ejemplo n.º 2
0
func ListArticle(w http.ResponseWriter, r *http.Request) {
	articles, _ := article.List()
	middleware.RenderJSON(w, articles)
}