Files
music_library/lib/music_library_web/controllers/health_controller.ex
T
Claudio Ortolina 1ec6712513 Add health controller
Fly.io uses '/health' to determine the application health status.
2024-09-28 15:27:59 +01:00

20 lines
442 B
Elixir

defmodule MusicLibraryWeb.HealthController do
use MusicLibraryWeb, :controller
alias MusicLibrary.Repo
def index(conn, _params) do
case Repo.query("SELECT 1") do
{:ok, _} ->
conn
|> put_resp_content_type("text/html")
|> send_resp(200, "App is running")
{:error, _} ->
conn
|> put_resp_content_type("text/html")
|> send_resp(500, "App is not running")
end
end
end