Example #1
0
func NowPlaying(c *echo.Context) error {
	recent, err := radioparadise.RecentSongs()
	if err != nil {
		return err
	}

	return c.JSONP(http.StatusOK, c.Query("callback"), &struct {
		Songs []*radioparadise.Song `json:"songs"`
	}{
		recent,
	})
}
Example #2
0
func GetProducts(c *echo.Context) error {
	i := kendoui.Input(c.Request())
	logger.Json(i)

	callback := c.Query("callback")
	if len(callback) == 0 {
		callback = "test"
	}

	products, err := ps.GetAll()
	if err == nil {
		err = c.JSONP(http.StatusOK, callback, products)
	}

	return err
}