aboutsummaryrefslogtreecommitdiffstats
path: root/guide
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-01-18 20:33:48 +0100
committerLoïc Hoguin <[email protected]>2013-01-18 20:33:48 +0100
commit645556a80ac1f906a995b107df762756cd105324 (patch)
treed0b5d38721772b43870375b96bae34559f3ab8ef /guide
parent6d98b320ff44909887b0007eb63340f69157c11f (diff)
downloadcowboy-645556a80ac1f906a995b107df762756cd105324.tar.gz
cowboy-645556a80ac1f906a995b107df762756cd105324.tar.bz2
cowboy-645556a80ac1f906a995b107df762756cd105324.zip
Document the static handler in the guide
Diffstat (limited to 'guide')
-rw-r--r--guide/static_handlers.md18
1 files changed, 17 insertions, 1 deletions
diff --git a/guide/static_handlers.md b/guide/static_handlers.md
index 5c897dd..f87515a 100644
--- a/guide/static_handlers.md
+++ b/guide/static_handlers.md
@@ -11,4 +11,20 @@ proper cache handling.
Usage
-----
-@todo Describe.
+Static handlers are pre-written REST handlers. They only need
+to be specified in the routing information with the proper options.
+
+The following example routing serves all files found in the
+`priv_dir/static/` directory of the application. It uses a
+mimetypes library to figure out the files' content types.
+
+``` erlang
+Dispatch = [
+ {'_', [
+ {['...'], cowboy_static, [
+ {directory, {priv_dir, static, []}},
+ {mimetypes, {fun mimetypes:path_to_mimes/2, default}}
+ ]}
+ ]}
+].
+```