cowboy_static.asciidoc 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. = cowboy_static(3)
  2. == Name
  3. cowboy_static - static file handler
  4. == Description
  5. The `cowboy_static` module implements file serving capabilities
  6. by using the REST semantics provided by `cowboy_rest`.
  7. == Types
  8. === opts() = [Option]
  9. [source,erlang]
  10. ----
  11. Option = {priv_file, atom(), string() | binary()}
  12. | {priv_file, atom(), string() | binary(), Extra}
  13. | {file, string() | binary()}
  14. | {file, string() | binary(), Extra}
  15. | {priv_dir, atom(), string() | binary()}
  16. | {priv_dir, atom(), string() | binary(), Extra}
  17. | {dir, string() | binary()}
  18. | {dir, string() | binary(), Extra}
  19. Extra = [ETag | Mimetypes]
  20. ETag = {etag, module(), function()} | {etag, false}
  21. Mimetypes = {mimetypes, module(), function()}
  22. | {mimetypes, binary() | {binary(), binary(), [{binary(), binary()}]}}
  23. ----
  24. Configuration for the static handler.
  25. The handler can be configured for sending either one file or
  26. a directory (including its subdirectories).
  27. Extra options allow you to define how the etag should be calculated
  28. and how the mimetype of files should be detected.