diff options
author | Loïc Hoguin <[email protected]> | 2012-01-05 01:04:12 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-01-05 01:04:12 +0100 |
commit | 5627277aa270aeb926b151a0dda18318add5bc01 (patch) | |
tree | 79cbeacf2ad694bc6774a5c04709a03957e88e81 /src | |
parent | 8ab05058e68ca7ac348416c5b7f6e4b075f65c74 (diff) | |
parent | 1592adcd4e3c8b596b499eaf14f1aeb6abfca58d (diff) | |
download | cowboy-5627277aa270aeb926b151a0dda18318add5bc01.tar.gz cowboy-5627277aa270aeb926b151a0dda18318add5bc01.tar.bz2 cowboy-5627277aa270aeb926b151a0dda18318add5bc01.zip |
Merge branch 'static-updates' of https://github.com/klaar/cowboy
Diffstat (limited to 'src')
-rw-r--r-- | src/cowboy_http_static.erl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cowboy_http_static.erl b/src/cowboy_http_static.erl index a98026d..94ba6cd 100644 --- a/src/cowboy_http_static.erl +++ b/src/cowboy_http_static.erl @@ -65,13 +65,25 @@ %% The mimetypes must be of a type that the `cowboy_http_rest' protocol can %% handle. %% +%% The <a href="https://github.com/spawngrid/mimetypes">spawngrid/mimetypes</a> +%% application, or an arbitrary function accepting the path to the file being +%% served, can also be used to generate the list of content types for a static +%% file resource. The function used must accept an additional argument after +%% the file path argument. +%% %% ==== Example ==== %% ``` +%% %% Use a static list of content types. %% {[<<"static">>, '...'], cowboy_http_static, %% [{directory, {priv_dir, cowboy, []}}, %% {mimetypes, [ %% {<<".css">>, [<<"text/css">>]}, %% {<<".js">>, [<<"application/javascript">>]}]}]} +%% +%% %% Use the default database in the mimetypes application. +%% {[<<"static">>, '...', cowboy_http_static, +%% [{directory, {priv_dir, cowboy, []}}, +%% {mimetypes, {fun mimetypes:path_to_mimes/2, default}}]]} %% ''' -module(cowboy_http_static). |