// TwitterHandler is a default handler to serve up samples for Github api
TwitterHandler is a default handler to serve up samples for Github api
// TwitterHandler is a default handler to serve up samples for Github api
func TwitterHandler(c buffalo.Context) error {
	query := "#tesla"
	searchResult, err := twitterAPI.GetSearch(query, nil)
	if err != nil {
		c.Set("errors", err)
		return errors.WithStack(err)
	}
	tweets := []string{}
	for _, tweet := range searchResult.Statuses {
		if tweet.RetweetedStatus == nil {
			tweets = append(tweets, tweet.Text)
		}
	}
	c.Set("query", query)
	c.Set("tweets", tweets)
	return c.Render(200, render.R.HTML("api-examples/twitter.html"))
}
func TwitterHandler ( c buffalo . Context ) error { query := " " searchResult , err := twitterAPI . GetSearch ( query , nil ) if err != nil { c . Set ( " " , err ) return errors . WithStack ( err ) } tweets := [ ] string { } for _ , tweet := range searchResult . Statuses { if tweet . RetweetedStatus == nil { tweets = append ( tweets , tweet . Text ) } } c . Set ( " " , query ) c . Set ( " " , tweets ) return c . Render ( 200 , render . R . HTML ( " " ) ) }
TwitterHandler is a default handler to serve up samples for Github api
TwitterHandler is a default handler to serve up samples for Github api