DSL design
Similar to the previous chapter, we want to build our DSL in a way that maximizes its readability by only displaying information that’s specific to what developers will be writing. The current version of the router in the tasks
application looks like this:
defmodule TasksWeb.Router do use Plug.Router alias TasksWeb.TaskController plug Plug.Parsers, parsers: [:urlencoded, :multipart], pass: ["text/html", "application/*"] plug :parse_body plug :match plug :dispatch get "/tasks/:id/delete", do: TaskController.call(conn, action: :delete) get "/tasks", do: TaskController.call(conn, action: :index) post "/tasks", do: TaskController.call(conn, action: :create) match _ do ...