diff --git a/README.md b/README.md index 6535377..0a9edef 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # Aloha Ruby Conference demo application Hopefully, when it's grown up, this will be an Erlang web app starter kit. + +# Steps + +rebar create app or something diff --git a/src/aloha.app.src b/src/aloha.app.src new file mode 100644 index 0000000..883330f --- /dev/null +++ b/src/aloha.app.src @@ -0,0 +1,12 @@ +{application, aloha, + [ + {description, ""}, + {vsn, "1"}, + {registered, []}, + {applications, [ + kernel, + stdlib + ]}, + {mod, { aloha_app, []}}, + {env, []} + ]}. diff --git a/src/aloha_app.erl b/src/aloha_app.erl new file mode 100644 index 0000000..59242ea --- /dev/null +++ b/src/aloha_app.erl @@ -0,0 +1,16 @@ +-module(aloha_app). + +-behaviour(application). + +%% Application callbacks +-export([start/2, stop/1]). + +%% =================================================================== +%% Application callbacks +%% =================================================================== + +start(_StartType, _StartArgs) -> + aloha_sup:start_link(). + +stop(_State) -> + ok. diff --git a/src/aloha_sup.erl b/src/aloha_sup.erl new file mode 100644 index 0000000..530c89b --- /dev/null +++ b/src/aloha_sup.erl @@ -0,0 +1,28 @@ + +-module(aloha_sup). + +-behaviour(supervisor). + +%% API +-export([start_link/0]). + +%% Supervisor callbacks +-export([init/1]). + +%% Helper macro for declaring children of supervisor +-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}). + +%% =================================================================== +%% API functions +%% =================================================================== + +start_link() -> + supervisor:start_link({local, ?MODULE}, ?MODULE, []). + +%% =================================================================== +%% Supervisor callbacks +%% =================================================================== + +init([]) -> + {ok, { {one_for_one, 5, 10}, []} }. +