aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_static.erl
diff options
context:
space:
mode:
authorMagnus Klaar <[email protected]>2012-01-04 02:22:21 +0100
committerMagnus Klaar <[email protected]>2012-01-05 01:01:03 +0100
commit54d16c14ad4e91489a297d4bd4031d2b546d7963 (patch)
tree0cc1928439c0eae1a355a0fea77a61e2c2e10fef /src/cowboy_http_static.erl
parent8ab05058e68ca7ac348416c5b7f6e4b075f65c74 (diff)
downloadcowboy-54d16c14ad4e91489a297d4bd4031d2b546d7963.tar.gz
cowboy-54d16c14ad4e91489a297d4bd4031d2b546d7963.tar.bz2
cowboy-54d16c14ad4e91489a297d4bd4031d2b546d7963.zip
Add test and doc for content types function.
Diffstat (limited to 'src/cowboy_http_static.erl')
-rw-r--r--src/cowboy_http_static.erl12
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).