Elixir/phoenix Flashcards
What is def?
def/2. A macro that let’s you define functions
What do AST tuples contain?
function name, metadata, and function arguments
what is the output of quote do:42
42
what is the output of quote do: "Hello"
“Hello”
what is the output of quote do: 1 + 2
is quote
a macro or a function?
macro
how do you get the textual code representation from a quoted expression?
Macro.to_string(quote do: sum(1, 2 + 3, 4))
Inner join example
left join example
What is the most common Webserver used with plug?
the Cowboy webservr
defp
defp/2 is a macro used to define private functions in the module
private functions vs regular functions
private functions cannot be called from other modules
how to change the port Phoenix runs on
go to config/dev.exs
and change the [port: 4000]
section to [port: System.get_env("PORT") || 4000]
and then boot up program in terminal like PORT=4444 mix phx.server
how to kill Phoenix process in terminal
Ctrl-C a ENTER