Summary
In this chapter, we learned how to leverage the Plug library to define a router to route incoming requests to a specific handler. We also learned about the Plug philosophy and why using Plug for web applications makes sense. We then used Plug.Conn.Adapter
behavior to define an adapter for the HTTP server we defined in the previous chapter. Finally, we wrapped up by defining a cleaner interface for using the plug.
In this chapter, we didn’t define all the implementations for callbacks defined in the Plug.Conn.Adapter
module. This was done to save time. We also didn’t write automated tests for this chapter because most of what we wrote can be tested similar to how HTTP servers were defined in previous chapters. We do intend on writing a better testing interface for our HTTP server, but we will do that in the DSL design part of this book.
In the next chapter, we will use our knowledge of Plug to build a controller interface to manage the flow of an incoming...