phoenix and the plug-life

17
Phoenix and the Plug-life

Upload: devmyndmichael

Post on 14-Aug-2015

73 views

Category:

Software


3 download

TRANSCRIPT

Page 1: Phoenix and the Plug-life

Phoenix and the Plug-life

Page 2: Phoenix and the Plug-life

What is Phoenix?

Page 3: Phoenix and the Plug-life

A productive, reliable, and fast web

framework

Page 4: Phoenix and the Plug-life

What is Plug?

Page 5: Phoenix and the Plug-life

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

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

“Hello, world” - Plug

Plug.Adapters.Cowboy.http(Pl, [])

Page 8: Phoenix and the Plug-life

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

Plug Routing

Plug.Adapters.Cowboy.http(Pl.Router, [])

Page 10: Phoenix and the Plug-life

Pipelines

Page 11: Phoenix and the Plug-life

“Hello, world” -Phoenix

Page 12: Phoenix and the Plug-life

Phoenix Routing

Page 13: Phoenix and the Plug-life

Phoenix Controllers

Page 14: Phoenix and the Plug-life

Controllers are just Plugs

Page 15: Phoenix and the Plug-life

Phoenix Template

Page 16: Phoenix and the Plug-life

Resources

• http://www.phoenixframework.org/v0.13.1/docs/overview

• http://hexdocs.pm/phoenix/

• https://github.com/elixir-lang/plug

• http://hexdocs.pm/plug/

Page 17: Phoenix and the Plug-life

devmynd.comgithub: crismali

twitter: @MichaelCrismaliemail:

[email protected]