1
0
Fork 0
mirror of https://github.com/benbusby/farside.git synced 2025-06-08 10:26:36 +00:00

add status routes

This commit is contained in:
mithereal 2022-09-17 14:34:10 -07:00
parent d5c3ec736c
commit ad2da6cdc6
3 changed files with 25 additions and 1 deletions

View file

@ -29,6 +29,26 @@ defmodule Farside.Router do
send_resp(conn, 200, resp)
end
get "/backup" do
resp = Jason.encode!(Farside.get_services_map())
conn =
conn
|> put_resp_content_type("application/json")
|> put_resp_header("content-disposition", "attachment; filename=farside.json")
|> Plug.Conn.send_resp(:ok, resp)
send_resp(conn, 200, resp)
end
get "/status" do
resp = Jason.encode!(Farside.get_services_map())
conn = conn |> merge_resp_headers([{"content-type", "application/json"}])
send_resp(conn, 200, resp)
end
get "/_/:service/*glob" do
r_path = String.slice(conn.request_path, 2..-1)