Exploring Plug: The Body Reader

Ever wondered why sometimes Plug.Conn.read_body/2 returns nil instead of returning the raw body of the request? Today we’ll examine why this happens and how to elegantly get around it. Plug crash course Before exploring why this happens, let’s take a step back and take a naive look on how Plug works. In it’s most basic sense, a plug is a transformation applied to a connection; a plug can be either a function or a module that receives information about a request in the form of %Plug.

Understanding Phoenix Endpoint

Averie Woodard on Unsplash This small article aims be to a rough walkthrough on how the Phoenix endpoint works. It assumes intermediate knowledge of Phoenix and Elixir. The endpoint is the boundary where all requests to your web application start. It is also the interface your application provides to the underlying web servers. https://hexdocs.pm/phoenix/Phoenix.Endpoint.html While navigating through the documentation for Phoenix.Endpoint, the paragraph above caught my attention, it affirmed for me the importance of this module.