I'm going through the Programming Phoenix book and I am wondering what the difference between def
and defp
is.
There are several functions in my controller - most of them are actions like this:
def new (conn, _params) do
...
end
The book had me create another function in this controller that is not a typical controller action like this:
defp user_videos(user) do
...
end
So my question is how do I know when to use defp
and when to use def
when defining a function inside a controller in the Phoenix Framework.