index.community/backend/lib/backend_web/controllers/graph_controller.ex

17 lines
458 B
Elixir
Raw Normal View History

2019-07-14 11:47:06 +00:00
defmodule BackendWeb.GraphController do
use BackendWeb, :controller
2019-08-21 15:47:45 +00:00
alias Graph.Cache
2019-07-14 11:47:06 +00:00
action_fallback BackendWeb.FallbackController
def index(conn, _params) do
2019-08-21 15:47:45 +00:00
%{nodes: nodes, edges: edges} = Cache.get_graph()
2019-07-14 11:47:06 +00:00
render(conn, "index.json", nodes: nodes, edges: edges)
end
2019-07-23 16:32:43 +00:00
def show(conn, %{"id" => domain}) do
2019-08-21 15:47:45 +00:00
%{nodes: nodes, edges: edges} = Cache.get_graph(domain)
2019-07-23 16:32:43 +00:00
render(conn, "index.json", nodes: nodes, edges: edges)
end
2019-07-14 11:47:06 +00:00
end