add health endpoints
Some checks are pending
Build and Publish / build-release (push) Waiting to run
Some checks are pending
Build and Publish / build-release (push) Waiting to run
This commit is contained in:
15
lib/policy_service_web/controllers/health_controller.ex
Normal file
15
lib/policy_service_web/controllers/health_controller.ex
Normal file
@@ -0,0 +1,15 @@
|
||||
defmodule PolicyServiceWeb.HealthController do
|
||||
use PolicyServiceWeb, :controller
|
||||
|
||||
def health(conn, _params) do
|
||||
conn
|
||||
|> put_status(:ok)
|
||||
|> json(%{status: "ok"})
|
||||
end
|
||||
|
||||
def ready(conn, _params) do
|
||||
conn
|
||||
|> put_status(:ok)
|
||||
|> json(%{status: "ready"})
|
||||
end
|
||||
end
|
||||
@@ -2,6 +2,7 @@ defmodule PolicyServiceWeb.Router do
|
||||
use PolicyServiceWeb, :router
|
||||
|
||||
alias PolicyServiceWeb.PolicyController
|
||||
alias PolicyServiceWeb.HealthController
|
||||
|
||||
pipeline :api do
|
||||
plug OpenApiSpex.Plug.PutApiSpec, module: PolicyServiceWeb.ApiSpec
|
||||
@@ -10,6 +11,9 @@ defmodule PolicyServiceWeb.Router do
|
||||
scope "/api" do
|
||||
pipe_through [:api]
|
||||
|
||||
get "/health", HealthController, :health
|
||||
get "/health/ready", HealthController, :ready
|
||||
|
||||
get "/openapi", OpenApiSpex.Plug.RenderSpec, []
|
||||
|
||||
scope "/v1" do
|
||||
|
||||
Reference in New Issue
Block a user