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

Add test and doc for content types function.

This commit is contained in:
Magnus Klaar 2012-01-04 02:22:21 +01:00
parent 8ab05058e6
commit 54d16c14ad
2 changed files with 28 additions and 2 deletions

View file

@ -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).