mirror of
https://github.com/correl/riichi.git
synced 2024-11-23 19:19:55 +00:00
Add cowboy web server
This commit is contained in:
parent
f6272d5b7f
commit
0b86dfc9c4
3 changed files with 19 additions and 1 deletions
8
priv/index.html
Normal file
8
priv/index.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Riichi Mahjong</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Riichi Mahjong</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -5,7 +5,8 @@
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{applications, [
|
{applications, [
|
||||||
kernel,
|
kernel,
|
||||||
stdlib
|
stdlib,
|
||||||
|
cowboy
|
||||||
]},
|
]},
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{mod, { riichi_app, []}},
|
{mod, { riichi_app, []}},
|
||||||
|
|
|
@ -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) ->
|
||||||
|
|
Loading…
Reference in a new issue