Echo - Decode JSON from request body
Echo - Decode JSON from request body
func addDog(c echo.Context) errr {
dog := Dog{}
err := c.Bind(&dog)
if err != nil {
log.Printf("Failed processing addDog request: %s\n", err)
return echo.NewHTTPError(http.StatusInternalServerError)
}
log.Printf("This is your dog: %#v\n", dog)
return c.String(http.StatusOK, "Got your dog!")
}
*** Sign up for my email list to keep in touch with all the interesting new happenings in the go community with the GolangNewsFeed