DSL design
For our DSL to be readable and easier to digest, it must show only the information that’s needed in our controller. Let’s take the following controller as an example. This is how we would write a controller today for it to work well with Goldcrest
:
defmodule TasksWeb.TaskController do use Plug.Builder import Goldcrest.Controller import Plug.Conn alias TasksWeb.Tasks plug :ensure_authorized! def call(conn, action: action) do conn = super(conn, []) apply(__MODULE__, action, [conn, conn.params]) end def index(conn, _params) do tasks = Tasks.list() conn |> put_status(200) |> render("tasks.html.eex", tasks: tasks) end def create(conn, %{"name" => name, "description"...