Download - Phoenix and the Plug-life
![Page 1: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/1.jpg)
Phoenix and the Plug-life
![Page 2: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/2.jpg)
What is Phoenix?
![Page 3: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/3.jpg)
A productive, reliable, and fast web
framework
![Page 4: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/4.jpg)
What is Plug?
![Page 5: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/5.jpg)
A specification for composable modules in
between web applications
Also, connection adapters for different web servers in the
Erlang VM
![Page 6: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/6.jpg)
Plugs can be• any function that accepts a
connection and options and returns the connection
• any module that implements `init` and `call`
• any module that `use`s Plug.Builder
![Page 7: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/7.jpg)
“Hello, world” - Plug
Plug.Adapters.Cowboy.http(Pl, [])
![Page 8: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/8.jpg)
Conn• Request and response rolled
together
• Just a struct at the end of the day
• direct interface to the underlying web server
• assigns is how you pass information from one plug to a future plug
![Page 9: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/9.jpg)
Plug Routing
Plug.Adapters.Cowboy.http(Pl.Router, [])
![Page 10: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/10.jpg)
Pipelines
![Page 11: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/11.jpg)
“Hello, world” -Phoenix
![Page 12: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/12.jpg)
Phoenix Routing
![Page 13: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/13.jpg)
Phoenix Controllers
![Page 14: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/14.jpg)
Controllers are just Plugs
![Page 15: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/15.jpg)
Phoenix Template
![Page 16: Phoenix and the Plug-life](https://reader035.vdocument.in/reader035/viewer/2022062515/55cddcdcbb61ebba208b47cb/html5/thumbnails/16.jpg)
Resources
• http://www.phoenixframework.org/v0.13.1/docs/overview
• http://hexdocs.pm/phoenix/
• https://github.com/elixir-lang/plug
• http://hexdocs.pm/plug/