Packages

Seven Otters is a set of facilities (macroes, functions, modules, etc.) developed to create CQRS/ES solutions in Elixir on BEAM virtual machine.

Current section

Files

Jump to
seven lib seven sync cqrs_router.ex
Raw

lib/seven/sync/cqrs_router.ex

defmodule Seven.Sync.CqrsRouter do
@moduledoc false
defmacro __using__(command_router: command_router, query_router: query_router) do
quote location: :keep do
use Plug.Router
alias Plug.Conn.Status
plug(Plug.Logger)
plug(CORSPlug)
plug(:match)
plug(:dispatch)
# forward "/command", to: Seven.EndpointCommandRouter
# forward "/query", to: Seven.EndpointQueryRouter
forward("/command", to: unquote(command_router))
forward("/query", to: unquote(query_router))
end
end
end