Raxx

Interface for HTTP webservers, frameworks and clients.

Hex pmBuild StatusLicense

Hello World!

Hello world example where the client sends a single request to the server and gets a single response back.

defmodule MyApp.WW do
  use Raxx.Server

  @impl Raxx.Server
  def handle_request(_request, _config) do
    response(:ok)
    |> set_header("content-type", "text/plain")
    |> set_body("Hello, World!")
  end
end

Echo server example where the request body is streamed back to the client as it becomes available.

defmodule MyApp.Echo do
  use Raxx.Server

  @impl Raxx.Server
  def handle_headers(_request, state) do
    outbound = response(:ok)
    |> set_body(true)

    {[outbound], state}
  end

  @impl Raxx.Server
  def handle_fragment(data, state) do
    outbound = fragment(data)

    {[outbound], state}
  end

  @impl Raxx.Server
  def handle_trailers(_trailers, state) do
    outbound = trailer()

    {[outbound], state}
  end
end

Raxx.Server specifies 5 callbacks allowing implementers to handle:

See documentation on hexdocs for details.

Community

Testing

To work with Raxx locally Elixir 1.4 or greater must be installed.

git clone git@github.com:CrowdHailer/raxx.git
cd raxx

mix deps.get
mix test