blob: 4140f51c3b9242ba8f9e2e8cd12d510b29c4925d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
-module(jchat_http_health).
-export([init/2]).
init(Req0, State) ->
Health = #{
<<"status">> => <<"ok">>,
<<"timestamp">> => jchat_utils:now_iso8601(),
<<"version">> => <<"0.1.0">>,
<<"config">> => #{
<<"api_domain">> => list_to_binary(jchat_config:api_domain()),
<<"web_domain">> => list_to_binary(jchat_config:web_domain())
}
},
Req1 = cowboy_req:reply(200, #{
<<"content-type">> => <<"application/json; charset=utf-8">>,
<<"access-control-allow-origin">> => <<"*">>
}, jchat_utils:json_encode(Health), Req0),
{ok, Req1, State}.
|