Closed arxdsilva closed 4 years ago
documentacao: ok docker: ok envs:
DB_...
nao existissem, por padrao (cloud) eh DATABASE_URL
, o comportamento correto seria falhar inicializacao caso n existissem.arquivos:
logica:
func (api *GroupAPI) GroupsGETHandler(c *gin.Context) {
var group *models.Group
var err error
group, err = group.GetByName(api.DB, c.Param("name"))
if err != nil {
if _, ok := err.(*models.ErrorGroupNotFound); ok {
c.JSON(http.StatusNotFound, errorResponseJSON{
"Group not found", err.Error(),
})
} else {
panic(err)
}
} else {
c.JSON(http.StatusOK, group)
}
}
https://github.com/tcarreira/superhero