示例#1
0
文件: controller.go 项目: mir/maratyv
func (cr *PublicationsApiController) Create(cx *goweb.Context) {
	if NotLoggedIn(cx) {
		cx.RespondWithStatus(UNAUTHORISED_HTTP_STATUS)
		return
	}
	c := appengine.NewContext(cx.Request)
	var pub model.Publication
	// Create an object from POST request
	err := cx.Fill(&pub)
	if err != nil {
		c.Errorf("Form-decoder: %v", err)
		return
	}

	pubs := model.PubsDAO.CreatePublication(pub, c)
	cx.RespondWithData(pubs)
}