From 645556a80ac1f906a995b107df762756cd105324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 18 Jan 2013 20:33:48 +0100 Subject: Document the static handler in the guide --- guide/static_handlers.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'guide') 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}} + ]} + ]} +]. +``` -- cgit v1.2.3