Routing requests
We'll now explore the flow of a traditional HTTP request, analyzing each step of the process up to when a response is rendered. As we've seen in the last section, Plug provides an adapter for the Cowboy web server, which we've used to demonstrate the two plugs we've created. Phoenix also uses this adapter to interact with the Cowboy web server. When a requests hits the server, this adapter handles it, creates a new conn (a %Plug.Conn{}
struct), and calls the endpoint configured in your application. By default, the endpoint is called <name_of_your_app>.Endpoint
. The endpoint is the boundary between the web server and our application code, so essentially the endpoint is the beginning of a request. Let's see the configuration for the endpoint:
$ cat apps/elixir_drip_web/config/config.exs config :elixir_drip_web, ElixirDripWeb.Endpoint, url: [host: "localhost"], secret_key_base: "ez09 ...9cbq", render_errors: [view: ElixirDripWeb.ErrorView, accepts: ~w(html json...