コード例 #1
0
ファイル: main.go プロジェクト: Fantasim/Langage-Go
func GetPost(c web.C, w http.ResponseWriter, r *http.Request) {
	post := controllers.Post{}

	post.Id, _ = strconv.Atoi(c.URLParams["id"])
	post.Token = r.FormValue("token")
	err := post.GetPostById()
	if err.Status == "KO" {
		helpers.RenderJSON(w, err, http.StatusOK)
	} else {
		post.PostModel.Status = "OK"
		helpers.RenderJSON(w, post.PostModel, http.StatusOK)
	}
}