tokumei v0.8.3 Raxx.Static View Source

To see how to use this module check the tests. The API is still in development as we handle some updates

defmodule StaticFileServer do
  require Raxx.Static

  # relative path to assets directory
  dir = "./static"
  Raxx.Static.serve_dir(dir)
end

other things this should do are:

  • send a response for a HEAD request
  • return a method not allowed for other HTTP methods
  • return content error from accept headers
  • gzip encoding plug doesnt actually gzip it just assumes a file named path <>.gz gzip is assumed false by default, say true to generate gz from contents or path modification if zipped exists. https://groups.google.com/forum/#!topic/elixir-lang-talk/RL-qWWx9ILE
  • have an overwritable not_found function
  • cache control time
  • Etags
  • filtered reading of a file
  • set a maximum size of file to bundle into the code.
  • static_content(content, mime)
  • check trying to serve root file
  • use plug semantics of {:app, path/in/priv} or “/binary/absoulte” or “./binary/from/file”

Link to this section Summary

Link to this section Functions

Link to this macro serve_dir(dir) View Source (macro)
Link to this macro serve_file(filename, path) View Source (macro)