示例#1
0
/**
 * GET artikel met id [1..n], retourneer een artikel
 *
 * @author A. Glansbeek en P. Kompier
 * @version 1.0
 * @date 2011-12-18
 */
func (cr *ArticleController) Read(id string, cx *goweb.Context) {
	params := map[string]string{"post_id": id}
	var m structs.WordpressPost

	models.CallWordpressApi(cx, &m, "get_post", params)

	if m.Post.Id == 0 {
		var str []string
		str = append(str, "Het opgevraagde id bestaat niet")

		cx.Respond(nil, 202, str, cx)
	} else {
		cx.RespondWithData(createArticle(m.Post))
	}
}