Hi. My name is Saúl, also known as @saulecabrera on the internet.
This is my personal space on the internet. I mostly ramble about dev tools, compilers
and programming in general.
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 its 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.
This small article aims be to a rough introduction to 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.