Phoenix and the Plug-life
-
Upload
devmyndmichael -
Category
Software
-
view
73 -
download
3
Transcript of Phoenix and the Plug-life
Phoenix and the Plug-life
What is Phoenix?
A productive, reliable, and fast web
framework
What is Plug?
A specification for composable modules in
between web applications
Also, connection adapters for different web servers in the
Erlang VM
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
“Hello, world” - Plug
Plug.Adapters.Cowboy.http(Pl, [])
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
Plug Routing
Plug.Adapters.Cowboy.http(Pl.Router, [])
Pipelines
“Hello, world” -Phoenix
Phoenix Routing
Phoenix Controllers
Controllers are just Plugs
Phoenix Template
Resources
• http://www.phoenixframework.org/v0.13.1/docs/overview
• http://hexdocs.pm/phoenix/
• https://github.com/elixir-lang/plug
• http://hexdocs.pm/plug/