Raxx.Static - Raxx middleware for serving static content

Completely rewritten in 0.8.0 release to be implemented as a standard Raxx.Middleware.

Example

@static_setup Raxx.Static.setup(source: "dir/of/public/content")

defmodule MyApp.WWW do
  def start_link(config, server_options) do
    stack =
      Raxx.Stack.new(
        [
          # Read files once at compile time
          {Raxx.Static, @static_setup},
          # Read files for each request
          {Raxx.Static, source: "dir/of/public/content"},
          # Other middleware
          {MyOtherMiddleware, option: :foo}
        ],
        {MyApp.WWW.Router, config}
      )

    Ace.HTTP.Service.start_link(stack, server_options)
  end
end
4 Likes

0.8.1 Fix bug affecting methods other than GET.

Thanks to @SchrodingerZhu for raising this issue.

1 Like