aboutsummaryrefslogtreecommitdiff
path: root/server/src/jchat_http_404.erl
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@pobox.com>2025-09-03 21:15:36 -0400
committerCalvin Morrison <calvin@pobox.com>2025-09-03 21:15:36 -0400
commit49fa5aa2a127bdf8924d02bf77e5086b39c7a447 (patch)
tree61d86a7705dacc9fddccc29fa79d075d83ab8059 /server/src/jchat_http_404.erl
i vibe coded itHEADmaster
Diffstat (limited to 'server/src/jchat_http_404.erl')
-rw-r--r--server/src/jchat_http_404.erl14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/src/jchat_http_404.erl b/server/src/jchat_http_404.erl
new file mode 100644
index 0000000..03f29cf
--- /dev/null
+++ b/server/src/jchat_http_404.erl
@@ -0,0 +1,14 @@
+-module(jchat_http_404).
+
+-export([init/2]).
+
+init(Req0, State) ->
+ Req1 = cowboy_req:reply(404, #{
+ <<"content-type">> => <<"application/json; charset=utf-8">>,
+ <<"access-control-allow-origin">> => <<"*">>
+ }, jsx:encode(#{
+ <<"error">> => <<"not_found">>,
+ <<"message">> => <<"Endpoint not found">>,
+ <<"suggestion">> => <<"Use web.jchat.localhost for the web interface">>
+ }), Req0),
+ {ok, Req1, State}.