2012-07-14 20:24:47 +02:00
|
|
|
%% Feel free to use, reuse and abuse the code in this file.
|
|
|
|
|
|
|
|
%% @private
|
|
|
|
-module(static_app).
|
|
|
|
-behaviour(application).
|
|
|
|
|
|
|
|
%% API.
|
|
|
|
-export([start/2]).
|
|
|
|
-export([stop/1]).
|
|
|
|
|
|
|
|
%% API.
|
|
|
|
|
|
|
|
start(_Type, _Args) ->
|
|
|
|
Dispatch = [
|
|
|
|
{'_', [
|
2012-08-27 13:53:27 +02:00
|
|
|
{['...'], cowboy_static, [
|
2012-10-08 14:25:39 -05:00
|
|
|
{directory, {priv_dir, static, []}},
|
|
|
|
{mimetypes, {fun mimetypes:path_to_mimes/2, default}}
|
2012-07-14 20:24:47 +02:00
|
|
|
]}
|
|
|
|
]}
|
|
|
|
],
|
2012-08-27 11:50:35 +02:00
|
|
|
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
|
|
|
{dispatch, Dispatch}
|
|
|
|
]),
|
2012-07-14 20:24:47 +02:00
|
|
|
static_sup:start_link().
|
|
|
|
|
|
|
|
stop(_State) ->
|
|
|
|
ok.
|