April 2024
Beginner to intermediate
224 pages
5h 7m
English
As requests come into an application, it’s important that they get sent to the right function in your application. Along the way, they’ll get transformed and interacted with by middleware functions. Middleware can serve any purpose, but you’ll often write middleware to set common data and validate that the request can be served.
Phoenix uses the Plug[70] library, which refers to middleware as “plugs.” Plugs can be either functions or modules.
Let’s look at how Phoenix encapsulates plugs inside of the Phoenix.Endpoint module. Once we get these basics down, we’ll move on to our controller.
The Phoenix generator creates several files as part of its generation process. These files relate to one ...
Read now
Unlock full access