From 49fa5aa2a127bdf8924d02bf77e5086b39c7a447 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Wed, 3 Sep 2025 21:15:36 -0400 Subject: i vibe coded it --- server/src/jchat_http_health.erl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 server/src/jchat_http_health.erl (limited to 'server/src/jchat_http_health.erl') diff --git a/server/src/jchat_http_health.erl b/server/src/jchat_http_health.erl new file mode 100644 index 0000000..4140f51 --- /dev/null +++ b/server/src/jchat_http_health.erl @@ -0,0 +1,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}. -- cgit v1.2.3