We have a good start to our code, but we should really expand on this a little bit more. In order for us to do that, we'll need to start off by modifying our controller. This should actually be very similar to what you've already seen in the past when displaying regular information to normal templates. We'll alias our Votes Context, grab the list of polls from our list_most_recent_polls/0 call, and then send that information on to our views! Let's take a look at the changes to lib/controllers/api/poll_controller.ex:
alias Vocial.Votes def index(conn, _params) do polls = Votes.list_most_recent_polls() render(conn, "index.json", polls: polls) end
Next, we'll need to set up the process for our data to go from the database ...