Add cowboy web server

This commit is contained in:
Correl Roush 2017-07-18 21:40:02 -04:00
parent 13a1f3f17c
commit daa5662aae
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, []},
{applications, [
kernel,
stdlib
stdlib,
cowboy
]},
{modules, []},
{mod, { riichi_app, []}},

View file

@ -10,6 +10,15 @@
%% ===================================================================
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().
stop(_State) ->