Why doesn't Phoenix use Plug to start the server?

liveforeverx on irc answered my original question and I changed this question as a follow up.

Phoenix depends on Plug for many of its functions. However, when it comes to starting a cowboy server, why doesn't Phoenix start it using the Plug api in Phoenix.Endpoint.CowboyHandler.start_link? Why is start_link on ranch_listener_sup running instead?

Is it because of any Plug limitations or is it because Phoenix started this journey much earlier than the Plug api matured?

My original question:

How / where does Phoenix start a cowboy?

Reading the Plug docs, I see that to start the server one needs to call

Plug.Adapters.Cowboy.http/3

      

However, grepping through my phoenix app and phoenix source code, I don't see any call instance Plug.Adapters.Cowboy.http/3

. How / where does Phoenix start a cowboy?

+3


source to share


1 answer


Two reasons:



  • To support websites

  • Since Phoenix runs the server inside the app control tree instead of running your app inside Cowboy

+8


source







All Articles