4 ms·
Controllers are the normal "C" inside MVC. That stuff that talks to your Models and passes it to the view / template layer. Plug [0] on the other hand is somet
by dvcrn 10y ago
Controllers are the normal "C" inside MVC. That stuff that talks to your Models and passes it to the view / template layer.
Plug [0] on the other hand is something like "rack" in the ruby world, a "A specification for composable modules between web applications". Phoenix is built on plug.
I think very simple you could say that plugs are pipes or similar to middlewares - functions that take the connection, transform it or do some checks based on something, then pass it to the next plug. Like a pipe full of functions.
Because phoenix is built on it, it is very easy to specify custom plugs and add them to your request / transform pipeline.
Someone correct me if I explained that wrong.
[0]: https://github.com/elixir-lang/plug https://github.com/elixir-lang/plug
- Roboprog 10y agoSo, it's slang for plug-in(s)? (services, extensions, ...)