Add cowboy web server

This commit is contained in:
Correl Roush 2017-07-18 21:40:02 -04:00
parent f6272d5b7f
commit 0b86dfc9c4
3 changed files with 19 additions and 1 deletions

8
priv/index.html Normal file
View file

@ -0,0 +1,8 @@
<html>
<head>
<title>Riichi Mahjong</title>
</head>
<body>
<h1>Riichi Mahjong</h1>
</body>
</html>

View file

@ -5,7 +5,8 @@
{registered, []}, {registered, []},
{applications, [ {applications, [
kernel, kernel,
stdlib stdlib,
cowboy
]}, ]},
{modules, []}, {modules, []},
{mod, { riichi_app, []}}, {mod, { riichi_app, []}},

View file

@ -10,6 +10,15 @@
%% =================================================================== %% ===================================================================
start(_StartType, _StartArgs) -> start(_StartType, _StartArgs) ->
Dispatch = cowboy_router:compile(
[{'_', [{"/", cowboy_static, {priv_file, riichi, "index.html"}}]}
]),
{ok, _} = cowboy:start_http(
my_http_listener,
100,
[{port, 8080}],
[{env, [{dispatch, Dispatch}]}]
),
riichi_sup:start_link(). riichi_sup:start_link().
stop(_State) -> stop(_State) ->