levpay / desafio

0 stars 4 forks source link

Desafio Tiago #6

Closed arxdsilva closed 4 years ago

arxdsilva commented 4 years ago

https://github.com/tcarreira/superhero

arxdsilva commented 4 years ago

documentacao: ok docker: ok envs:

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)
    }
}