Summary

In the process of adding a web layer to our application, we covered a lot of ground in this chapter. Let's run through the most important points in this chapter:

  • Phoenix builds upon the Plug specification, which has two forms: module and function plugs. Both of them take a connection and return a connection, possibly modifying it before returning.
  • An endpoint is the boundary where all requests to our web application start, and by default it contains a list of plugs that run for every request.
  • Using macros, routers in Phoenix compile down to efficient pattern matching. Besides defining routes, we can create pipelines in the router, which are a group of plugs that run sequentially.
  • Controller actions are functions that receive two ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.