/support/templates/mochiwebapp_skel/src/mochiapp.erl

http://github.com/basho/mochiweb · Erlang · 30 lines · 16 code · 7 blank · 7 comment · 0 complexity · d6a8aae0a46c5dd771b7723910acbf75 MD5 · raw file

  1. %% @author {{author}}
  2. %% @copyright {{year}} {{author}}
  3. %% @doc {{appid}}.
  4. -module({{appid}}).
  5. -author("{{author}}").
  6. -export([start/0, stop/0]).
  7. ensure_started(App) ->
  8. case application:start(App) of
  9. ok ->
  10. ok;
  11. {error, {already_started, App}} ->
  12. ok
  13. end.
  14. %% @spec start() -> ok
  15. %% @doc Start the {{appid}} server.
  16. start() ->
  17. {{appid}}_deps:ensure(),
  18. ensure_started(crypto),
  19. application:start({{appid}}).
  20. %% @spec stop() -> ok
  21. %% @doc Stop the {{appid}} server.
  22. stop() ->
  23. application:stop({{appid}}).