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:
parent
24a22fa657
commit
28f90b81fa
7 changed files with 43 additions and 57 deletions
|
@ -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).
|
|
@ -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">>]}
|
||||
]}
|
||||
]}
|
||||
]}
|
||||
]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue