Просмотр исходного кода

Document the static handler in the guide

Loïc Hoguin 12 лет назад
Родитель
Сommit
645556a80a
1 измененных файлов с 17 добавлено и 1 удалено
  1. 17 1
      guide/static_handlers.md

+ 17 - 1
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}}
+		]}
+	]}
+].
+```