analytics/lib/plausible_web/controllers/api/internal_controller.ex
2019-10-24 14:58:17 +08:00

18 lines
369 B
Elixir

defmodule PlausibleWeb.Api.InternalController do
use PlausibleWeb, :controller
use Plausible.Repo
def domain_status(conn, %{"domain" => domain}) do
has_pageviews = Repo.exists?(
from e in Plausible.Event,
where: e.hostname == ^domain
)
if has_pageviews do
json(conn, "READY")
else
json(conn, "WAITING")
end
end
end