Plugs
Last updated
Last updated
Plugs implement two fts init
and call
which takes in a conn and return a conn
Must fetch them before use, best placed in the router.ex plug list. For example, the cookies
field uses .
cookies
- the request cookies with the response cookies
body_params
- the request body params, populated through a parser.
query_params
- the request query params, populated through
path_params
- the request path params, populated by routers such as
params
- the request params, the result of merging the :path_params
on top of :body_params
on top of :query_params
req_cookies
- the request cookies (without the response ones)
Ft
Effect
Assigns a value to a key in the connection.
Return status
Sends a response with the given status and body.
react_phoenix_web/plugs
some controller
Usage conn.assigns.current_user
router.ex
lib/discuss_web/plugs/auth.ex
app.html.eex
Stops the plug pipeline .