Router dispatch

Hi all
Could someone explain me please, what is a router dispatcher and when this will be executed? After router pipeline?

Thanks

1 Like

Hello!

May be this will help:

connection
|> endpoint
|> router
|> pipeline
|> controller
|> view
|> template

And check this guide.

Why do you mark template bold?

Editor marked it - I don’t know why - maybe reserved word :slight_smile:

template

So is router dispatcher between pipeline and controller?

Could you please specify what is router dispatcher?

In many OO web frameworks router and dispatcher are separate classes router just does the match and dispatcher actually executes the handler. I am guessing @kostonstyle is coming from the world of OO web frameworks.

1 Like

pipelines, routers, controllers, etc are all plugs. I recommend reading through Plug, and then taking a look at some of the phoenix code. The short version is that a Plug is a function (or module with a call/2 function) that takes and returns a %Plug.Conn{} struct, which represents a connection. These sequence of functions transform the conn. All a router is is a plug that takes a conn that has the path information, and passes it on to some other plug on the basis of that path information.

3 Likes