2013-01-30 00:30:05 +04:00
|
|
|
%% Feel free to use, reuse and abuse the code in this file.
|
|
|
|
|
|
|
|
%% @private
|
2013-09-07 16:23:13 +02:00
|
|
|
-module(rest_basic_auth_app).
|
2013-01-30 00:30:05 +04:00
|
|
|
-behaviour(application).
|
|
|
|
|
|
|
|
%% API.
|
|
|
|
-export([start/2]).
|
|
|
|
-export([stop/1]).
|
|
|
|
|
|
|
|
%% API.
|
|
|
|
|
|
|
|
start(_Type, _Args) ->
|
2013-01-29 22:02:13 +01:00
|
|
|
Dispatch = cowboy_router:compile([
|
2013-01-30 00:30:05 +04:00
|
|
|
{'_', [
|
2013-01-29 22:02:13 +01:00
|
|
|
{"/", toppage_handler, []}
|
2013-01-30 00:30:05 +04:00
|
|
|
]}
|
2013-01-29 22:02:13 +01:00
|
|
|
]),
|
2013-01-30 00:30:05 +04:00
|
|
|
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
|
|
|
{env, [{dispatch, Dispatch}]}
|
|
|
|
]),
|
2013-09-07 16:23:13 +02:00
|
|
|
rest_basic_auth_sup:start_link().
|
2013-01-30 00:30:05 +04:00
|
|
|
|
|
|
|
stop(_State) ->
|
|
|
|
ok.
|