index.community/backend/lib/backend_web/controllers/graph_controller.ex
2019-07-23 16:32:43 +00:00

20 lines
473 B
Elixir

defmodule BackendWeb.GraphController do
use BackendWeb, :controller
alias Backend.Api
action_fallback BackendWeb.FallbackController
def index(conn, _params) do
nodes = Api.list_nodes()
edges = Api.list_edges()
render(conn, "index.json", nodes: nodes, edges: edges)
end
def show(conn, %{"id" => domain}) do
nodes = Api.list_nodes(domain)
edges = Api.list_edges(domain)
render(conn, "index.json", nodes: nodes, edges: edges)
end
end