1
0
mirror of https://github.com/mgerb/classic-wow-forums synced 2026-01-10 09:02:50 +00:00
This commit is contained in:
2017-12-31 20:19:44 -06:00
commit e856cc5172
37 changed files with 1196 additions and 0 deletions

22
lib/myapp_web/response.ex Normal file
View File

@@ -0,0 +1,22 @@
defmodule MyAppWeb.Response do
# error handling based on http status
def json(conn, data) do
output = cond do
conn.status && conn.status >= 400 ->
%{
error: %{
status: conn.status,
message: data,
}
}
true -> %{
data: data
}
end
Phoenix.Controller.json(conn, output)
end
end