this repo has no description
1defmodule EslHnWeb.API.JSON do
2 @moduledoc """
3 Simple JSON view into Hacker New stories
4 """
5
6 def index(attrs) do
7 Enum.map(attrs.items, &one/1)
8 end
9
10 def show(attrs) do
11 one(attrs.item)
12 end
13
14 defp one(%EslHn.Hn.Story{} = story) do
15 %{
16 id: story.id,
17 title: story.title,
18 url: story.url,
19 score: story.score
20 }
21 end
22end