Elixir is perhaps the first functional language to support Lisp-style macros with a more natural syntax. This feature, like a template for code, is not always the right tool for everyday users, but macros are invaluable for extending the Elixir language to add the common features all web servers need to support.
For example, web servers need to map routes onto functions that do the job:
|||pipeline :browser do|
|||plug :accepts, ["html"]|
|||pipeline :api do|
|||plug :accepts, ["json"]|
|||scope "/", MyApp do|
|||get "/users", UserController, :index|
|||scope "/api/", MyApp do|
You’ll see this code a little later. ...