2 ms·
Plug is actually very hard to learn, because its design is very simple, but knowing how to use this design to produce the effect you need requires a whole lot o
by klibertp 5y ago
Plug is actually very hard to learn, because its design is very simple, but knowing how to use this design to produce the effect you need requires a whole lot of mental gymnastics. A less generic design would account for, for example, "initialize this state on first time this plug is called" (I think something changed here, but don't remember if for the better) and similar things, but then it would be less generic and possibly not flexible enough to support all the things Phoenix and co. need from it.
That being said, Plug is still better than Phoenix, so if you're not in rush to build something and can experiment, then learning Plug first will give you better understanding of Phoenix later on.
- nelsonic 5y agoIf anyone else is stuck learning Plug, the Elixir School tutorial is a good starting point: https://github.com/dwyl/elixir-plug-tutorial https://github.com/dwyl/elixir-plug-tutorial