March 2019
Beginner to intermediate
324 pages
7h 17m
English
This handler will be very similar to the GetProducts handler, except that it will use a different database call to retrieve the list of promotions instead of the list of products:
func (h *Handler) GetPromos(c *gin.Context) { if h.db == nil { return } promos, err := h.db.GetPromos() if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } c.JSON(http.StatusOK, promos)}
Read now
Unlock full access