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 arguments: the connection and the parameters of the request. Usually, we aim to keep our controller code as small as possible, calling some other module and rendering a view based on its response.
- Views are plain modules with rendering functions. Templates are...