This is an additional golang package for the beego web framework to simplify error and response handling within controllers. It wraps functionality of *BeegoOutput.
Example project for a use case can be found in the mongodm-example package.
- pagination
- direct JSON error response
- custom data appending
func (self *UsersController) Me() {
if self.token != nil && self.user != nil {
self.response.AddContent("user", self.user)
self.response.ServeJSON()
} else {
self.response.Error(http.StatusBadRequest)
}
}
Feel free to contribute!