View Source Mar.Route protocol (Mar v0.2.6)

Mar.Route protocol lets you access Plug.Conn.

defmodule MyApp do
  # ...

  defimpl Mar.Route do
    # Mar.Route.MyApp

    def before_action(route) do
      # Access `route.conn` before the actions you have defined.
      route
    end

    def after_action(route) do
      # Access `route.conn` after the actions you have defined.
      route
    end
  end
end

Summary

Types

t()

All the types that implement this protocol.

Types

@type t() :: term()

All the types that implement this protocol.

Functions

@spec after_action(t()) :: t()
@spec before_action(t()) :: t()