Add a health endpoint
This commit is contained in:
parent
c214b3e7e3
commit
53f4bc5ecf
|
@ -0,0 +1,7 @@
|
|||
defmodule ChronoscopeWeb.API.V1.HealthController do
|
||||
use ChronoscopeWeb, :controller
|
||||
|
||||
def get(conn, _params) do
|
||||
json(conn, %{healthy: true})
|
||||
end
|
||||
end
|
|
@ -20,6 +20,12 @@ defmodule ChronoscopeWeb.Router do
|
|||
get "/", PageController, :home
|
||||
end
|
||||
|
||||
scope "/api/v1", ChronoscopeWeb.API.V1 do
|
||||
pipe_through :api
|
||||
|
||||
get "/health", HealthController, :get
|
||||
end
|
||||
|
||||
scope "/api/v1/nts", ChronoscopeWeb.API.V1.NTS do
|
||||
pipe_through :api
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
defmodule ChronoscopeWeb.API.V1.HealthControllerTest do
|
||||
use ChronoscopeWeb.ConnCase, async: true
|
||||
|
||||
test "indicates health", %{conn: conn} do
|
||||
response =
|
||||
conn
|
||||
|> get(~p"/api/v1/health")
|
||||
|> json_response(200)
|
||||
|
||||
assert %{"healthy" => true} == response
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue