aboutsummaryrefslogtreecommitdiff
path: root/server/src/jchat_http_404.erl
diff options
context:
space:
mode:
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}.