curl api.ipify.org - return external ip address
self()
spawn_link(self(), fn -> raise “oops” end)
spawn(…)
send(pid, {:get, :hello, self()})
flush()
{:ok, pid} = Agent.start_link(fn -> %{} end)
Agent.update(pid, fn map -> Map.put(map, :hello, :world) end)
Agent.get(pid, fn map -> Map.get(map, :hello) end)
opts \ [] - optional parameter that will default to empty list
mix phx.new statmeet
cd statmeet
edit config/dev.exs
mix deps.get
mix ecto.create
mix phx.gen.auth Accounts User users
mix phx.gen.html Markups Note notes contents:text
Example of adding Hello page
lib/
"/", AppWeb do
scope ...
"/somepath", HelloController, :index
get
end
lib/
defmodule HelloWeb.HelloController do
use HelloWeb, :controller
def index(conn, _params) do
(conn, "index.html")
renderend
end
lib/
defmodule HelloWeb.HelloView do
use HelloWeb, :view
end
lib/
<section class="phx-hero">
<h2>Hello World, from Phoenix!</h2>
</section>
mix phx.gen.schema Markups markups content:text
mix phx.gen.html Catalog Product products title:string description:string price:decimal views:integer
mix ecto.gen.migration update_notes
edit file in priv/repo/migrations/
mix ecto.migrate