0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 20:50:24 +00:00

Convert the static handler example to a release

Temporarily hardcode the list of mimetypes.
This commit is contained in:
Loïc Hoguin 2013-09-09 15:51:41 +02:00
parent 24a22fa657
commit 28f90b81fa
7 changed files with 43 additions and 57 deletions

View file

@ -1,15 +0,0 @@
%% Feel free to use, reuse and abuse the code in this file.
-module(static_world).
%% API.
-export([start/0]).
%% API.
start() ->
ok = application:start(crypto),
ok = application:start(cowlib),
ok = application:start(ranch),
ok = application:start(cowboy),
ok = application:start(static_world).

View file

@ -15,7 +15,12 @@ start(_Type, _Args) ->
{'_', [
{"/[...]", cowboy_static, [
{directory, {priv_dir, static_world, []}},
{mimetypes, {fun mimetypes:path_to_mimes/2, default}}
{mimetypes, [
{<<".html">>, [<<"text/html">>]},
{<<".txt">>, [<<"text/plain">>]},
{<<".mp4">>, [<<"video/mp4">>]},
{<<".ogv">>, [<<"video/ogg">>]}
]}
]}
]}
]),