Files
EventHubBack/src/handlers/admin/admin_handler_health.erl

36 lines
872 B
Erlang

-module(admin_handler_health).
-behaviour(cowboy_handler).
-export([init/2]).
-export([trails/0]).
%%% cowboy_handler callback
init(Req, _State) ->
case cowboy_req:method(Req) of
<<"GET">> ->
handler_utils:send_json(Req, 200, #{status => <<"ok">>});
_ ->
handler_utils:send_error(Req, 405, <<"Method not allowed">>)
end.
%%% Swagger metadata
trails() ->
[
#{
path => <<"/admin/health">>,
method => <<"GET">>,
description => <<"Admin API health check">>,
tags => [<<"Health">>],
responses => #{
200 => #{
description => <<"API is healthy">>,
content => #{<<"application/json">> => #{schema => #{
type => object,
properties => #{
status => #{type => string}
}
}}}
}
}
}
].