defmodule Elstat.API.CurrentStatus do require Logger def init(req0, state) do data = Elstat.Manager.get_current_state() req = :cowboy_req.reply(200, %{"content-type" => "text/json", "Access-Control-Allow-Origin" => "*"}, Poison.encode!(data), req0 ) {:ok, req, state} end end defmodule Elstat.API.Status do def init(req0, state) do status = Elstat.Manager.get_current_state() graph = Elstat.Manager.get_graph_state() req = :cowboy_req.reply(200, %{"content-type" => "text/json", "Access-Control-Allow-Origin" => "*"}, Poison.encode!(%{ status: status, graph: graph, }), req0 ) {:ok, req, state} end end