From 13d8ff0560ddc433eee5af0aeb4e0285febb08bf Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Thu, 2 Jun 2016 18:10:05 +0800 Subject: [PATCH] Update --- phoenix-conn.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ phoenix.md | 46 +++------------------------------------------- 2 files changed, 49 insertions(+), 43 deletions(-) create mode 100644 phoenix-conn.md diff --git a/phoenix-conn.md b/phoenix-conn.md new file mode 100644 index 000000000..2f16d9c0a --- /dev/null +++ b/phoenix-conn.md @@ -0,0 +1,46 @@ +--- +title: "Phoenix: Plug.Conn" +category: Elixir +--- + +## Request + +```elixir +conn.host #=> "example.com" +conn.method #=> "GET" +conn.path_info #=> ["posts", "1"] +conn.request_path #=> "/posts/1" +conn.query_string #=> "utm_source=twitter" +conn.port #=> 80 +conn.scheme #=> :http +conn.peer #=> {{127, 0, 0, 1}, 12345} +conn.remote_ip #=> {151, 236, 219, 228} +conn.req_headers #=> [{"content-type", "text/plain"}] +``` + +## Response + +```elixir +conn.resp_body #=> "..." +conn.resp_charset #=> "utf-8" +conn.resp_cookies #=> ... +conn.resp_headers #=> ... +conn.status #=> ... +``` + +## Misc + +```elixir +conn.assigns # storage of crap +conn.owner # process +conn.halted # if pipeline was halted +conn.secret_key_base # ... +conn.state # :unset, :set, :file, :sent, :chunked +``` + +## Session + +``` +conn = put_session(conn, :message, "new stuff we just set in the session") +get_session(conn, :message) +``` diff --git a/phoenix.md b/phoenix.md index 08f379669..137e765d2 100644 --- a/phoenix.md +++ b/phoenix.md @@ -16,46 +16,6 @@ web/ static/ ``` -## Plug.Conn - -### Request - -```elixir -conn.host #=> "example.com" -conn.method #=> "GET" -conn.path_info #=> ["posts", "1"] -conn.request_path #=> "/posts/1" -conn.query_string #=> "utm_source=twitter" -conn.port #=> 80 -conn.scheme #=> :http -conn.peer #=> {{127, 0, 0, 1}, 12345} -conn.remote_ip #=> {151, 236, 219, 228} -conn.req_headers #=> [{"content-type", "text/plain"}] -``` - -### Response - -```elixir -conn.resp_body #=> "..." -conn.resp_charset #=> "utf-8" -conn.resp_cookies #=> ... -conn.resp_headers #=> ... -conn.status #=> ... -``` - -### Misc - -```elixir -conn.assigns # storage of crap -conn.owner # process -conn.halted # if pipeline was halted -conn.secret_key_base # ... -conn.state # :unset, :set, :file, :sent, :chunked -``` - -### Session - -``` -conn = put_session(conn, :message, "new stuff we just set in the session") -get_session(conn, :message) -``` +- [Plug.Conn](./phoenix-conn.html) +- [Ecto migrations](./phoenix-migrations.html) +- [Router](./phoenix-routing.html)